create-error.js
v0.0.5
Published
Create custom extendable error types.
Readme
create-error.js
Create custom extendable error types
npm install create-error.jsexample:
var createError = require('create-error.js');
var BaseError = createError('BaseError');
var CustomError = createError('CustomError', BaseError);
console.log(new CustomError() instanceof BaseError) // true
throw new CustomError('throw a custom error')APi Refs
createError(name[, base, code])
basedefault:Errorcodedefault:1- if arguments length is 2 and the 2nd argument is an number, use it as
code, else asbase.
License
MIT (c) Chao Wang [email protected]
