nodeunit
nodeunit copied to clipboard
Allow importing custom error types
Hi,
I am using node unit and I defined custom error types in this fashion :
var errors = {}
errors.UnknownAttributeError = function(message) {
this.name = "UnknownAttributeError";
this.message = message || "UnknownAttributeError";
}
errors.UnknownAttributeError.prototype = new Error();
errors.UnknownAttributeError.prototype.constructor = errors.UnknownAttributeError;
module.exports = errors;
when I import the errors file as so :
var Errors = require('./../../lib/relational/errors');
The new Error() is caught and raised, but I think it should not be...
Yeah, that doesn't sound right. Nodeunit doesn't do anything special looking for new Error() calls... if you can send a pull request with a failing test case I'll take a look.