fasterror
Quickly create custom error objects.
Last updated 11 years ago by willwhite .
BSD · Original npm · Tarball · package.json
$ npm install fasterror 
SYNC missed versions from official npm registry.

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.

Current Tags

  • 1.1.0                                ...           latest (8 years ago)

3 Versions

  • 1.1.0                                ...           8 years ago
  • 1.0.0                                ...           9 years ago
  • 0.0.0                                ...           11 years ago
Maintainers (1)
Downloads
Total 0
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (1)
Dev Dependencies (1)
Dependents (0)
None

© 2010 - cnpmjs.org x YWFE | Home | YWFE