Add somewhat decent error handling finally
This commit is contained in:
parent
93370c7fe2
commit
1f0b700e82
13
bot.js
13
bot.js
@ -134,11 +134,18 @@ fs.open('./config/usersettings.json','r',function(err, fd){
|
|||||||
if(err) {
|
if(err) {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
}
|
}
|
||||||
console.log("usersettings.json did not exist, it has been created");
|
console.log("[main.setup] usersettings.json did not exist, it has been created");
|
||||||
});
|
});
|
||||||
fs.writeFileSync('./config/usersettings.json', "\{\n\}")
|
fs.writeFileSync('./config/usersettings.json', "\{\n\}")
|
||||||
} else {
|
} else {
|
||||||
console.log("usersettings.json exists, continuing");
|
console.log("[main] usersettings.json exists, continuing");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
console.log('[main.irc] Connecting to '+config.irc.server+'/'+config.irc.port+' as '+config.irc.nickname);
|
console.log('[main.irc] Connecting to '+config.irc.server+'/'+config.irc.port+' as '+config.irc.nickname);
|
||||||
|
|
||||||
|
process.on('uncaughtException', function (err) {
|
||||||
|
console.error(err);
|
||||||
|
if (config.errorhandling.log_errors_to_irc == 'true') {
|
||||||
|
bot.say(config.errorhandling.error_channel, errorMsg+" "+err.stack.split('\n',1).join(" "))
|
||||||
|
}
|
||||||
|
});
|
@ -8,12 +8,17 @@
|
|||||||
],
|
],
|
||||||
"nickname": "mercury",
|
"nickname": "mercury",
|
||||||
"username": "mercury",
|
"username": "mercury",
|
||||||
"realname": "git.supernets.org/hogwart7/mercury",
|
"realname": "git.supernets.org/hgw/mercury",
|
||||||
"autorejoin": "true",
|
"autorejoin": "true",
|
||||||
"floodprotection": "false",
|
"floodprotection": "false",
|
||||||
"floodprotectiondelay": "0",
|
"floodprotectiondelay": "0",
|
||||||
"prefix": "m!"
|
"prefix": "m!"
|
||||||
},
|
},
|
||||||
|
"errorhandling": {
|
||||||
|
"error_logging": "true",
|
||||||
|
"error_channel": "#CHANNELTOSENDERRORSTO",
|
||||||
|
"error_channel_pass": ""
|
||||||
|
},
|
||||||
"colours": {
|
"colours": {
|
||||||
"date": "11",
|
"date": "11",
|
||||||
"brackets": "15",
|
"brackets": "15",
|
||||||
|
Loading…
Reference in New Issue
Block a user