custom-error-type

0.0.4 • Public • Published

CustomErrorType

install

npm install custom-error-type

simple usage

CustomErrorType = require('custom-error-type');

MyError = CustomErrorType('MyError');

throw new MyError('just an error');

advanced usage

CustomErrorType = require('custom-error-type');

MyError2 = CustomErrorType('MyError2', JSON.stringify);

throw new MyError2({a: 1, b: 2});

reference

Tero's answer @stackoverflow

Package Sidebar

Install

npm i custom-error-type

Weekly Downloads

2

Version

0.0.4

License

MIT

Last publish

Collaborators

  • luochen1990