forked from GitHub/dbot
Merge pull request #327 from zuzak/dns
remove try catch in favour of boring if(error){}
This commit is contained in:
commit
5cacab729d
@ -10,7 +10,6 @@ var dns = function(dbot) {
|
|||||||
domain = event.params[1];
|
domain = event.params[1];
|
||||||
dnsmod.lookup(domain, function (error, addr) {
|
dnsmod.lookup(domain, function (error, addr) {
|
||||||
if (error) {
|
if (error) {
|
||||||
console.log(error);
|
|
||||||
event.reply(dbot.t("lookup-error",{"domain": domain, "code": error.code}));
|
event.reply(dbot.t("lookup-error",{"domain": domain, "code": error.code}));
|
||||||
} else {
|
} else {
|
||||||
event.reply(dbot.t("lookup",{"domain": domain, "address": addr}));
|
event.reply(dbot.t("lookup",{"domain": domain, "address": addr}));
|
||||||
@ -19,18 +18,14 @@ var dns = function(dbot) {
|
|||||||
},
|
},
|
||||||
'~rdns': function(event) {
|
'~rdns': function(event) {
|
||||||
ip = event.params[1];
|
ip = event.params[1];
|
||||||
try {
|
|
||||||
dnsmod.reverse(ip, function (error, domain) {
|
dnsmod.reverse(ip, function (error, domain) {
|
||||||
if (error) {
|
if (error) {
|
||||||
throw error;
|
event.reply(dbot.t("rdns-error",{"domain": domain, "ip": ip, "error": error.code}));
|
||||||
}
|
} else {
|
||||||
event.reply(dbot.t("rdns",{"domain": domain, "ip": ip}));
|
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;
|
this.commands = commands;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user