You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A generic Error object for use when performing XHR requests. XHR component writers are encouraged to use this Error object to signal errors / incomplete requests.
XhrError is a tiny object that serves 1 purpose, to signal an error in an XHR requests.
varXhrError=require('xhrerror');functiondoAjaxyRequest(url,callback){
...
// Oops, there was an error.varerr=newXhrError("Oops, couldn't find that.",404);callback(err);}
API
XhrError(message, status, request)
Create a new XhrError. Optionally provide a message string, a status code and the full failed request.
XhrError#status
The status code returned from the XHR attempt.
XhrError#message
Inheriting from Error#message, the string message for the error.
XhrError#request
Inheriting from Error#request, the request obj for the error. Access err.req.getAllResponseHeaders().
XhrError#stack
Inheriting from Error#stack, the stack trace from which the XhrError was created.
Dependencies
None.
About
Cross-browser Error object for use with XHR requests