From 57dcc0daf16324a188f5ee9c6035d0655849de24 Mon Sep 17 00:00:00 2001 From: Douglas Gardner Date: Fri, 22 Mar 2013 15:39:29 +0000 Subject: [PATCH] remove try catch in favour of boring if(error){} --- modules/dns/dns.js | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/modules/dns/dns.js b/modules/dns/dns.js index 83d5d9f..e061d83 100644 --- a/modules/dns/dns.js +++ b/modules/dns/dns.js @@ -10,7 +10,6 @@ var dns = function(dbot) { domain = event.params[1]; dnsmod.lookup(domain, function (error, addr) { if (error) { - console.log(error); event.reply(dbot.t("lookup-error",{"domain": domain, "code": error.code})); } else { event.reply(dbot.t("lookup",{"domain": domain, "address": addr})); @@ -19,18 +18,14 @@ var dns = function(dbot) { }, '~rdns': function(event) { ip = event.params[1]; - try { - dnsmod.reverse(ip, function (error, domain) { - if (error) { - throw error; - } + dnsmod.reverse(ip, function (error, domain) { + if (error) { + event.reply(dbot.t("rdns-error",{"domain": domain, "ip": ip, "error": error.code})); + } else { event.reply(dbot.t("rdns",{"domain": domain, "ip": ip})); - }); - } catch (err) { - event.reply(dbot.t("rdns-error",{"domain": domain, "ip": ip, "error": err})); - } + } + }); } - }; this.commands = commands;