Create custom Error classes.
Install with npm:
$ npm i error-base --save
Usage
var errorBase = ; // Create a new HelperError that takes additional options.var HelperError = ; try // Throw a HelperError given the custom arguments throw 'some error message' helper: 'helper-name' foo: 'bar' ; catch err console; //=> 'some error message' console; //=> { helper: 'helper-name', foo: 'bar' }
API
errorBase
Code modified from http://stackoverflow.com/a/27925672/914583
Params
name
{String}: Name of new Error Classinit
{Function}: Function to call when creating new Errorcapture
{Boolean}: Optional parameter to determine if the stack trace should be captured or not. (Defaults totrue
)returns
{Function}: new Error Class
Example
var CustomError = ;
Running tests
Install dev dependencies:
$ npm i -d && npm test
Contributing
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Author
Brian Woodward
License
Copyright © 2016 Brian Woodward Released under the MIT license.
This file was generated by verb on February 10, 2016.