Comparing version 0.0.4 to 0.0.5
@@ -13,3 +13,3 @@ | ||
429: "Too Many Requests", | ||
500: "Unknown error", | ||
500: "Unknown", | ||
501: "Not Implemented", //use this for features not implemented yet | ||
@@ -29,2 +29,3 @@ | ||
exports.codes = {}; | ||
exports.byCode = {}; | ||
exports.register = function(codes) { | ||
@@ -62,3 +63,3 @@ Object.keys(codes).forEach(function(code) { | ||
exports.byCode[code] = Err; | ||
exports.codes[className] = code; | ||
@@ -69,3 +70,9 @@ }); | ||
exports.fromCode = function(code, message) { | ||
var clazz = exports.byCode[Number(code)] || Error; | ||
return new clazz(message); | ||
} | ||
exports.register(DEFAULT_CODES); | ||
{ | ||
"name": "comerr", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"description": "ERROR: No README.md file found!", | ||
@@ -15,2 +15,2 @@ "main": "lib/index.js", | ||
"license": "BSD" | ||
} | ||
} |
2051
54