Comparing version 1.0.7 to 1.0.8
@@ -19,3 +19,8 @@ /** | ||
req.onload = function() { | ||
resolve(JSON.parse(req.response)); | ||
if (req.status < 200 || req.status >= 400) return reject(new Error('Error ' + req.status)); | ||
try { | ||
resolve(JSON.parse(req.response)); | ||
} catch (err) { | ||
reject(err); | ||
} | ||
}; | ||
@@ -30,2 +35,2 @@ req.onerror = reject.bind(null, new Error('Error ' + req.status)); | ||
} | ||
exports.getJSON = getJSON; | ||
exports.getJSON = getJSON; |
{ | ||
"name": "xhr-tool", | ||
"version": "1.0.7", | ||
"version": "1.0.8", | ||
"description": "XMLHttpRequest with Promises (in the browser)", | ||
@@ -5,0 +5,0 @@ "keywords": [ "xhr", "promises", "es6" ], |
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
2739
48