extend-error icon indicating copy to clipboard operation
extend-error copied to clipboard

Configure SubType via object with more customizations

Open ianwremmel opened this issue 10 years ago • 0 comments

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 errors. (instead of passing errorCode, add {properties: {code: <code>}} to the options object.

  3. Adds ability to provide alternate toString().

  4. 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);
    }
    
  5. Just like #4, makes monkeypatching optional.

ianwremmel avatar Apr 13 '15 05:04 ianwremmel