From e9480b6f6493bbc2220d269d6e30a888f2306ace Mon Sep 17 00:00:00 2001 From: reality Date: Thu, 24 Jan 2013 21:46:18 +0000 Subject: [PATCH] put onLoad in try/catch, add status message for failure. [#198] --- run.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/run.js b/run.js index 9f18098..15a110e 100644 --- a/run.js +++ b/run.js @@ -294,7 +294,11 @@ DBot.prototype.reloadModules = function() { _.each(this.modules, function(module, name) { if(module.onLoad) { - module.onLoad(); + try { + module.onLoad(); + } catch(err) { + this.status[name] = 'Error in onLoad: ' + err + ' ' + err.stack.split('\n')[1].trim(); + } } }, this);