If you have an instance of XMLHttpRequest
that has timed out or been aborted, but you didn't do anything during the onTimeout events for example, how can we see what state the instance of XMLHttpRequest is in?
For example, if a request returns a 404 - it's possible to see this in the status
property long after the request is complete.
But timeouts doesn't seem to leave anything behind. the readyState
on timeout is 'done', and there is no response
- but no way to know why there is no response (timeout, connectivity issue, abort, etc etc).
Context:
I'm using Backbone
. Which uses a XMLHttpRequest
from jQuery
. The errorText/exception recieved by aborts/timeouts are not surfaced by Backbone
to the applications logic, only the XHR
instance itself.
Hence the need to find this information from the XHR
directly without attaching an onTimeout
event handler etc etc.
Looks like the solution might be to adapt the way it attaches the timeout event, or bubble up it's errors.