mistake
create error object
npm install mistake
Arguments
mistake(name, message|spec, Factory)
- name |
String
: name of the error (error.name
) - message |
String
: message of the error (error.message
) - spec |
Object
: Object with keys-values that will get passed to the Error instance - Factory |
Function
: optional Function constructor you want your Error based off.
Notes:
This project uses UMD wrapper, meaning it can be used via Node (CommonJs), (AMD) RequireJs or global through window.mistake
.
Node:
var mistake = ;var error = ;
RequireJs:
;
Globally:
var mistake = windowmistake;var error = ;
Implementation
basic
var mistake = ; throw ;
name and hash
var mistake = ; throw ;
name and hash and constructor
var mistake = ; { thisname = 'MyError'; thismessage = message || 'Default Message'; thisbar = 'foo';} throw ;