custom-err

v0.0.2
Easily create an error with custom properties attached.
err custom custom-error customerror

custom-err

Easily create an error object with custom properties attached.

API

Err(message, properties)

Usage

var Err    = require('custom-err'),
    assert = require('assert');

// the first argument represents the error message
// the second argument represents the custom properties object
var myErr = Err('NotFound', { code: 404 });

assert.equal(myErr.message, 'NotFound');
assert.equal(myErr.code, 404);

License

MIT

npm i custom-err

Metadata

  • MIT
  • Whatever
  • Alexandru Vladutu
  • released 10/19/2013

Downloads

Maintainers