JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 28334949
  • Score
    100M100P100Q212241F
  • License ISC

Make your own error types!

Package Exports

  • make-error

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (make-error) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

make-error

Build Status Dependency Status devDependency Status

Make your own error types!

Features

  • Compatible Node & browsers
  • instanceof support
  • error.name & error.stack support

Installation

Node

Installation of the npm package:

> npm install --save make-error

Then require the package:

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

Browser

Clone the git repository and compile the browser version of the library:

> git clone https://github.com/julien-f/js-make-error.git
> npm install
> npm run browserify

Then import the script make-error.js which has been compiled in the dist/ directory:

<script src="make-error.js"></script>

Usage

function CustomError() {
  CustomError.super.call(this, 'custom error message');
}
makeError(CustomError);

function SpecializedCustomError() {
  SpecializedCustomError.super.call(this);
}
makeError(SpecializedCustomError, CustomError);

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