JSPM

custom-err

0.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • 0
  • Score
    100M100P100Q35881F
  • License MIT

Easily create an error with custom properties attached.

Package Exports

  • custom-err

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (custom-err) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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