extend-error
extend-error copied to clipboard
Easily define custom error types in Node.js
Would you consider using a custom method for extending vs augmenting the native `Error` Object with the `extent()` method? i.e. ``` js var extendError = require('extend-error'); var CustomError = extendError('CustomError');...
There are merged changes that are not in NPM yet, such as the error name being displayed wrong due to using string replace. Please bump version in NPM so we...
Ref: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/message Error.prototype.message is default message of instances, for example: ``` var NotFoundError = Error.extend("NotFoundError", 404); NotFoundError.prototype.message = "Not Found"; var err = new NotFoundError(); console.log(err.toString()); //NotFoundError: 'Not Found' ```...
Still needs some tests, but much more robust than #4. 1. `extend()` now accepts an options object as alternative to the `subTypeName` and `errorCode` parameters. 2. Decreases emphasis on HTTP-related...