fix UserError checking

This commit is contained in:
Romain Beaumont 2016-03-14 19:36:57 +01:00
parent bccfc5d10c
commit a12039e1bd
2 changed files with 2 additions and 1 deletions

View file

@ -115,7 +115,7 @@ module.exports.player=function(player, serv) {
if (res) player.chat(serv.color.red + res);
}
catch(err) {
if (err instanceof UserError) player.chat(serv.color.red + 'Error: ' + err.message);
if (err.userError) player.chat(serv.color.red + 'Error: ' + err.message);
else setTimeout(() => {throw err;}, 0);
}
}

View file

@ -9,6 +9,7 @@ class ExtendableError extends Error {
class UserError extends ExtendableError {
constructor(message) {
this.userError=1;
super(message);
}
}