Create custom error types that work with instanceof
and have stack traces.
Consider the following from our tests:
require('should');
var makeTypedError = require('typed-errors').makeTypedError;
var FooException = makeTypedError('FooException');
it('should be an instanceof', function () {
try {
throw new FooException('Foobar!');
} catch (e) {
e.should.be.an.instanceof(FooException);
e.should.be.an.instanceof(Error);
}
});
npm install typed-errors
- Issue Tracker: github.com/bodylabs/typed-errors/issues
- Source Code: github.com/bodylabs/typed-errors
Pull requests welcome!
If you are having issues, please let us know.
The project is licensed under the two-clause BSD license.