handle-xhr-error 🚨
A tiny module to handle errors in an xhr request in an emitter based application.
var handleXHRError = var emitter = var xhr = var opts = method: 'PUT' url: 'user/2' json: kitty: cat headers: 'content-type': 'application/json'
API
handleXHRError(data, error, emitter [,cb])
- data: data to pass on to the error message
- error.err: error to emit
- error.statusCode: error status code
- emitter.emitter: an instance of an emitter you're using
- emitter.namespace: namespace used for the emitter, e.g.
user
orlogin
- cb: optional callback to pass the error obj back to