Comparing version 2.0.0 to 2.0.1
@@ -49,4 +49,4 @@ "use strict"; | ||
clearTimeout(timeoutTimer) | ||
if(! evt instanceof Error){ | ||
evt = new Error(""+evt) | ||
if(!(evt instanceof Error)){ | ||
evt = new Error("" + (evt || "unknown") ) | ||
} | ||
@@ -89,2 +89,5 @@ evt.statusCode = 0 | ||
options = options || {} | ||
if(typeof callback === "undefined"){ | ||
throw new Error("callback argument missing") | ||
} | ||
callback = once(callback) | ||
@@ -91,0 +94,0 @@ |
{ | ||
"name": "xhr", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "small xhr abstraction", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -104,2 +104,21 @@ var window = require("global/window") | ||
assert.end() | ||
}) | ||
test("handles errorFunc call with no arguments provided", function (assert) { | ||
var req = xhr({}, function (err) { | ||
assert.ok(err instanceof Error, "callback should get an error") | ||
assert.equal(err.message, "unknown", "error message should say 'unknown'") | ||
}) | ||
assert.doesNotThrow(function () { | ||
req.onerror() | ||
}, "should not throw when error handler called without arguments") | ||
assert.end() | ||
}) | ||
test("constructs and calls callback without throwing", function (assert) { | ||
assert.throws(function () { | ||
xhr({}) | ||
}, "callback is not optional") | ||
assert.end() | ||
}) |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
15799
8
247
0