makeerror
A library to make errors.
Basics
Makes an Error constructor function with the signature below. All arguments are optional, and if the first argument is not a String
, it will be assumed to be data
:
You'll typically do something like:
er
will have a prototype chain that ensures:
Templatized Error Messages
There is support for simple string substitutions like:
Now er.message
or er.toString()
will return 'The specified type "bmp" is not known.'
.
Prototype Hierarchies
You can create simple hierarchies as well using the prototype
chain:
er
will have a prototype chain that ensures:
Last updated