This commit is contained in:
David Humphrey (:humph) david.humphrey@senecacollege.ca 2014-07-24 12:24:47 -04:00
parent 79e9008175
commit 9d704e80c9
1 changed files with 7 additions and 6 deletions

View File

@ -77,16 +77,17 @@ var errors = {};
err = e[1], err = e[1],
message = e[2]; message = e[2];
function ctor(m) { function FilerError(m) {
this.name = err;
this.code = err;
this.errno = errno;
this.message = m || message; this.message = m || message;
} }
var proto = ctor.prototype = new Error(); FilerError.prototype = Object.create(Error.prototype);
proto.errno = errno; FilerError.prototype.constructor = FilerError;
proto.code = err;
proto.constructor = ctor;
// We expose the error as both Errors.EINVAL and Errors[18] // We expose the error as both Errors.EINVAL and Errors[18]
errors[err] = errors[errno] = ctor; errors[err] = errors[errno] = FilerError;
}); });
module.exports = errors; module.exports = errors;