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 component.
$ component install matthewp/xhrerror
XhrError is a tiny object that serves 1 purpose, to signal an error in an XHR requests.
var XhrError = require('xhrerror');
function doAjaxyRequest(url, callback) {
...
// Oops, there was an error.
var err = new XhrError("Oops, couldn't find that.", 404);
callback(err);
}
Create a new XhrError
. Optionally provide a message
string, a status
code and the full failed request
.
The status code returned from the XHR attempt.
Inheriting from Error#message
, the string message for the error.
Inheriting from Error#request
, the request obj for the error. Access err.req.getAllResponseHeaders().
Inheriting from Error#stack
, the stack trace from which the XhrError was created.
None.