Closed aviddiviner closed 7 years ago
You can use error.target on the ProgressEvent passed to the error handler to get back the underlying XMLHttpRequest instance. For example:
d3.text("/file/not/found", function(error, text) {
if (error) {
console.log("fail", error.target.status);
} else {
console.log("success", text);
}
});
Hi.
When I get a 404 response, the "error" event that's fired only includes an XHR ProgressEvent (in Chrome), and nothing else. That would be this code path.
This isn't too helpful, and I was wondering if you could expose the
xhr.status
or more details of the underlying XHR itself. Perhaps either as an extra part of the error payload, or similarly to how you allow the user access to the XHR on the request.response(fn) method.I like that I can do
So on an error I want to
Thanks! And thanks for the amazing software. You rock!