standard-http-error
Advanced tools
Comparing version 2.0.0 to 2.0.1
@@ -0,1 +1,4 @@ | ||
## 2.0.1 (Sep 12, 2017) | ||
- Removes a trailing comma for old Internet Explorer compatibility. | ||
## 2.0.0 (Oct 4, 2015) | ||
@@ -2,0 +5,0 @@ - Updates HTTP status codes and constants from Node v4: |
var CODES = require("http").STATUS_CODES | ||
exports = module.exports = require("./codes.json") | ||
for (var code in CODES) code in exports || (exports[code] = CODES[code]) | ||
for (var code in CODES) if (!(code in exports)) exports[code] = CODES[code] |
@@ -9,3 +9,3 @@ exports = module.exports = HttpError | ||
if (typeof code != "number") throw new TypeError("Non-numeric HTTP code") | ||
if (typeof msg == "object" && msg != null) props = msg, msg = null | ||
if (typeof msg == "object" && msg != null) { props = msg; msg = null } | ||
StandardError.call(this, msg || STATUS_CODE_TO_NAME[code], props) | ||
@@ -50,4 +50,4 @@ this.code = code | ||
get: function() { return this[name] }, | ||
set: function(value) { return this[name] = value }, | ||
set: function(value) { return this[name] = value } | ||
} | ||
} |
{ | ||
"name": "standard-http-error", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "Standard HTTP error class. Proper serialization, no bloat. Extensible.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -6,3 +6,5 @@ var O = require("oolong") | ||
function RemoteError(code, msg) { HttpError.apply(this, arguments) } | ||
function RemoteError(code, msg, props) { | ||
HttpError.call(this, code, msg, props) | ||
} | ||
@@ -24,7 +26,7 @@ RemoteError.prototype = Object.create(HttpError.prototype, { | ||
it("must throw TypeError given undefined code", function() { | ||
!function() { new HttpError(undefined) }.must.throw(TypeError, /HTTP/) | ||
(function() { new HttpError(undefined) }).must.throw(TypeError, /HTTP/) | ||
}) | ||
it("must throw TypeError given null code", function() { | ||
!function() { new HttpError(null) }.must.throw(TypeError, /HTTP/) | ||
(function() { new HttpError(null) }).must.throw(TypeError, /HTTP/) | ||
}) | ||
@@ -37,3 +39,3 @@ | ||
it("must throw TypeError given unknown constant", function() { | ||
!function() { new HttpError("DUNNO") }.must.throw(TypeError, /HTTP/) | ||
(function() { new HttpError("DUNNO") }).must.throw(TypeError, /HTTP/) | ||
}) | ||
@@ -40,0 +42,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
23129
276