is-fail
Tiny and dependency-free node.js/io.js package implementing multiple strategies to verify if an HTTP request was failed, checking both error and HTTP response code.
Useful to combine as part of a retry/backoff logic. Also allows you to plug in additional strategies.
Installation
npm install is-fail --save
Usage
Simple usage as part of a retry mechanism
const http = const isFail = { http }
Plug in additional strategies
const http = const isFail = { return resstatusCode === 404} const checkFail = http
API
=>
Function(err, res) =>
Boolean
isFail([ strategies ]) =
Array[ Strategy ]
isFail.strategies =>
Boolean
isFail.check(strategies, err, res) =
Array[ ErrorStrategy ]
isFail.errors =
Array[ StatusStrategy ]
isFail.status License
MIT - Tomas Aparicio