Simple base error class.
Installation
$ npm install errorx
Example
var Err = ;var SomeError = Err; // for format message using util.formatthrow 'Foo %s' 'bar'; /*throw new SomeError('Foo %s', 'bar'); ^SomeError: Foo bar at Object.<anonymous> (/foo/bar/baz/index.js:6:7) at Module._compile (module.js:449:26) at Object.Module._extensions..js (module.js:467:10) at Module.load (module.js:349:32) ...*/ var err = Err; try throw path: '/foo/' result: msg: 'property bar must be a string' ; catch err if errstatusCode === 400 console; // >>> HttpBadRequestError: Bad request "/foo/": {"msg":"property bar must be a string"} // Capture another error var err = 'ups'; throw err 'Foo %s' 'bar'; /*throw new SomeError(err, 'Foo %s', 'bar'); ^SomeError: Foo bar [Error: ups] at Object.<anonymous> (/foo/bar/baz/index.js:7:7) at Object.<anonymous> (/foo/bar/baz/index.js:5:7) at Module._compile (module.js:449:26) at Object.Module._extensions..js (module.js:467:10) at Module.load (module.js:349:32) ...*/
Inherits
For inheritance detail see obx
Running tests
$ make test
Authors
License
MIT