errorist
If you don't have an Error, errorist gives you one
Install
$ npm install errorist
Usage
var errorist = ; { process;} ; // or with promises // stack trace FTW throw ; );
Notes
errorist's flow is a bit like this:
- If the value is an
Error
return
it.
- If the value is a non-
null
object or function- and its
message
property is astring
return
a newError
with themessage
.
- otherwise
- stringify the object into JSON
- upon success
return
the stringified object as theError
'smessage
.
- otherwise
return
an emptyError
instance.
- and its
- Otherwise
return
anError
instance with the primitive,null
, orundefined
value as its message.
License
© 2015 Christopher Hiller. Licensed MIT.