stderror
Extendable error class derived from native Error object.
Installation
$ npm install stderror
Usage
var StandardError = ; throw ;throw "My custom error.";throw code: 1000 message: "My custom error."; //-- also works without using newthrow ;
Methods
extend(name)
extend(options)
Returns the derived error object based on the given argument.
var UnknownError = StandardError;var SystemError = StandardError; var RecordNotFound = StandardError;var UserNotFound = RecordNotFound;
define(name)
define(options)
A form of namespacing errors by encapsulating them in a parent error object.
var Exception = StandardError;Exception;Exception; throw ;throw ;