mirror of
https://github.com/reality/dbot.git
synced 2024-11-23 20:39:25 +01:00
Add a debug mode that shows the error and the top of the stack trace in the case of an error if activated.
This commit is contained in:
parent
950ba882b8
commit
81217ece50
@ -13,5 +13,6 @@
|
|||||||
},
|
},
|
||||||
"admins": [ "batman" ],
|
"admins": [ "batman" ],
|
||||||
"moduleNames": [ "ignore", "admin", "command", "dice", "js", "kick", "puns", "quotes", "spelling", "youare" ],
|
"moduleNames": [ "ignore", "admin", "command", "dice", "js", "kick", "puns", "quotes", "spelling", "youare" ],
|
||||||
"language": "english"
|
"language": "english",
|
||||||
|
"debugMode": true
|
||||||
}
|
}
|
||||||
|
@ -79,7 +79,15 @@ var command = function(dbot) {
|
|||||||
} else {
|
} else {
|
||||||
if(!isIgnoring(event.user, commandName)) {
|
if(!isIgnoring(event.user, commandName)) {
|
||||||
if(applyRegex(commandName, event)) {
|
if(applyRegex(commandName, event)) {
|
||||||
dbot.commands[commandName](event);
|
try {
|
||||||
|
dbot.commands[commandName](event);
|
||||||
|
} catch(err) {
|
||||||
|
if(dbot.config.debugMode == true) {
|
||||||
|
event.reply('- Error in ' + commandName + ':');
|
||||||
|
event.reply('- Message: ' + err);
|
||||||
|
event.reply('- Top of stack: ' + err.stack.split('\n')[1].trim());
|
||||||
|
}
|
||||||
|
}
|
||||||
dbot.save();
|
dbot.save();
|
||||||
} else {
|
} else {
|
||||||
if(commandName !== '~') {
|
if(commandName !== '~') {
|
||||||
|
2
run.js
2
run.js
@ -5,7 +5,7 @@ require('./snippets');
|
|||||||
|
|
||||||
var DBot = function(timers) {
|
var DBot = function(timers) {
|
||||||
// Load external files
|
// Load external files
|
||||||
var requiredConfigKeys = [ 'name', 'servers', 'admins', 'moduleNames', 'language' ];
|
var requiredConfigKeys = [ 'name', 'servers', 'admins', 'moduleNames', 'language', 'debugMode' ];
|
||||||
try {
|
try {
|
||||||
this.config = JSON.parse(fs.readFileSync('config.json', 'utf-8'));
|
this.config = JSON.parse(fs.readFileSync('config.json', 'utf-8'));
|
||||||
} catch(err) {
|
} catch(err) {
|
||||||
|
Loading…
Reference in New Issue
Block a user