custom-error-js

1.0.2 • Public • Published

Simple library to create js custom error, the correct way. Uses the method suggested here and here.

Usage

const BadNewsError = require('custom-error-js')('BadNews')

const e = new BadNewsError('It just crashed')

// e.name == 'BadNews'
// e.message == 'It just Crashed'
// e instanceOf Error

throw e

Readme

Keywords

Package Sidebar

Install

npm i custom-error-js

Weekly Downloads

1

Version

1.0.2

License

MIT

Last publish

Collaborators

  • trouve.antoine