2.0.6 • Published 2 years ago
error-maker v2.0.6
Error Maker
Error Maker is a library for making new error types easily.
Installation
Use the package manager npm or yarn to install Error Maker.
npm i error-maker
# OR
yarn add error-maker
Usage
Using CommonJS
const ErrorFactory = require('error-maker');
const ValidationError = ErrorFactory.create('ValidationError');
// ...
throw new ValidationError('Invalid input');
// Or you can specify an additional cause
throw new ValidationError('Invalid input', 'there it goes!');
Using ES Modules
import ErrorFactory from 'error-maker';
const ValidationError = ErrorFactory.create('ValidationError');
// ...
throw new ValidationError('Invalid input');
// Or you can specify an additional cause
throw new ValidationError('Invalid input', 'there it goes!');
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.