event refactor and errors

This commit is contained in:
Peter Cottle 2012-09-10 12:55:49 -07:00
parent 4f30ad73a8
commit 3d1890bb3b
3 changed files with 111 additions and 36 deletions

23
src/errors.js Normal file
View file

@ -0,0 +1,23 @@
function CommandProcessError(msg) {
this.msg = msg;
}
CommandProcessError.prototype = _.copy(Error.prototype);
CommandProcessError.prototype.toString = function() {
return 'Command Process Error: ' + this.msg;
};
function CommandResult(msg) {
this.msg = msg;
}
CommandResult.prototype = _.copy(Error.prototype);
CommandResult.prototype.toString = function() {
return 'Command Result: ' + this.msg;
};
CommandResult.prototype.toResult = function() {
return this.msg.replace('\n', '</br>');
};