make-error

Package Version Build Status PackagePhobia Latest Commit

Make your own error types!

Features

  • Compatible Node & browsers

  • instanceof support

  • error.name & error.stack support

  • compatible with CSP (i.e. no eval())

Installation

Installation of the npm package:

> npm install --save make-error

Then require the package:

var makeError = require("make-error");

Browser

You can directly use the build provided at unpkg.com:

Usage

Basic named error

Advanced error class

Specialized error

Inheritance

Best for ES2015+.

Contributions

Contributions are very welcomed, either on the documentation or on the code.

You may:

  • report any issue you've encountered;

  • fork and create a pull request.

License

ISC © Julien Fontanet

Last updated