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.

Dependencies (0)

    Dev Dependencies (2)

    Package Sidebar

    Install

    npm i fasterror

    Weekly Downloads

    2,281

    Version

    1.1.0

    License

    BSD

    Last publish

    Collaborators

    • jrpruit1
    • rclark
    • willwhite