makeerror
Advanced tools
Comparing version 1.0.0 to 1.0.1
{ | ||
"name": "makeerror", | ||
"description": "A library to make errors.", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"author": "Naitik Shah <n@daaku.org>", | ||
"main": "index", | ||
"main": "lib/makeerror", | ||
"repository": { | ||
@@ -11,3 +11,3 @@ "type": "git", | ||
}, | ||
"scripts": { "test": "./node_modules/.bin/expresso" }, | ||
"scripts": { "test": "./node_modules/.bin/expresso -c" }, | ||
"devDependencies": { | ||
@@ -14,0 +14,0 @@ "expresso": ">= 0.8.1" |
makeerror | ||
========= | ||
A library to make errors. | ||
A library to make errors. Makes an Error constructor function with the signature: | ||
function(message, data) | ||
You'll typically do something like: | ||
var makeError = require('makeerror') | ||
var UnknownFileTypeError = makeError( | ||
'UnknownFileTypeError', | ||
'The specified type is not known.' | ||
) | ||
var er = UnknownFileTypeError() | ||
`er` will have a prototype chain that ensures: | ||
er instanceof Error | ||
er instanceof UnknownFileTypeError | ||
You can also do `var er = new UnknownFileTypeError()` if you really like the | ||
`new` keyword. |
4637
6
77
24