extend-error
extend-error copied to clipboard
Configure SubType via object with more customizations
Still needs some tests, but much more robust than #4.
-
extend()now accepts an options object as alternative to thesubTypeNameanderrorCodeparameters. -
Decreases emphasis on HTTP-related errors. (instead of passing
errorCode, add{properties: {code: <code>}}to theoptionsobject. -
Adds ability to provide alternate
toString(). -
Adds
parseFn(), which can do additional processing on the SubType constructor argument. I'm primarily envisioning it as a way to wrap http error responses with an Error:if (res.statusCode === 404) { throw new HttpNotFoundError(res); } -
Just like #4, makes monkeypatching optional.