errors
errors copied to clipboard
Errors is a comprehensive, robust, yet lightweight set of error utilities for node.js enabling you to do errors more effectively.
By including `express` in the list of dependencies in `package.json`, it makes `express` a required dependency of the package. That means that the checks in `lib/errors.js` will always load the...
It would be nice to have the message string as a template against the other properties of the object... (suggest ES6 string template format, lodash has an implementation) example: ```...
There is an exported method called `isError()`: https://github.com/bodenr/errors/blob/master/lib/errors.js#L112 This should be added to the docs as it's very useful for differentiating between errors created by this module and other errors....
Code: ``` javascript var errors = require('errors'); errors.create({ name: 'FooError' }); throw new errors.FooError('custom message'); ``` Output: ``` myndzi@tetrisguide:~/foo$ node -v v0.10.33 myndzi@tetrisguide:~/foo$ node test /home/myndzi/foo/test.js:7 throw new errors.FooError('custom message');...
The `HttpXXXError` instances of have a "code" property of type string, where newly created errors would have a type of number (starting at 600).
``` js var errors = require('errors'); errors.create({ name: 'ValidationError', defaultMessage: 'Validation error', defaultExplanation: 'Some properties are not valid', defaultResponse: 'Resend the object with valid properties', parent: errors.Http400Error }); // Status...
The docs here: https://nodejs.org/api/errors.html#errors_error_capturestacktrace_targetobject_constructoropt claim that the target of the `captureStackTrace` method's `.toString` method will be used to generate the error message line, but it doesn't seem to be so,...