Socket
Socket
Sign inDemoInstall

fasterror

Package Overview
Dependencies
0
Maintainers
3
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    fasterror

Quickly create custom error objects.


Version published
Weekly downloads
1.5K
increased by8.12%
Maintainers
3
Created
Weekly downloads
 

Readme

Source

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.

FAQs

Last updated on 25 Oct 2016

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc