fasterror

1.1.0 • Public • Published

fasterror

Quickly create custom error objects.

Build Status

var fasterror = require('fasterror');
var MyError = fasterror('MyError', {code: 'ENOENT'});

fasterror() is the factory for creating custom error objects. The first argument is the name of the desired custom error object. The second is an object containing keys that will decorate any errors created with the resulting object.

var username = 'jsmith';
var err = new MyError('Failed to load user %s', username);

Create new errors with the resulting class. The error created will perform string interpolation on the arguments passed and set the resulting value as err.message. See node.js documentation for interpolation details.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.1.0
    1,452
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.1.0
    1,452
  • 1.0.0
    0
  • 0.0.0
    0

Package Sidebar

Install

npm i fasterror

Weekly Downloads

1,452

Version

1.1.0

License

BSD

Last publish

Collaborators

  • jrpruit1
  • rclark
  • willwhite