https://github.com/jcoreio/superagent-verbose-errors
include response body in superagent errors for failed requests
https://github.com/jcoreio/superagent-verbose-errors
error error-handling superagent verbose
Last synced: 7 months ago
JSON representation
include response body in superagent errors for failed requests
- Host: GitHub
- URL: https://github.com/jcoreio/superagent-verbose-errors
- Owner: jcoreio
- License: mit
- Created: 2018-02-22T19:35:58.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-02-22T19:56:12.000Z (over 7 years ago)
- Last Synced: 2024-11-12T21:51:44.411Z (8 months ago)
- Topics: error, error-handling, superagent, verbose
- Language: JavaScript
- Size: 73.2 KB
- Stars: 3
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# superagent-verbose-errors
[](https://travis-ci.org/jcoreio/superagent-verbose-errors)
[](https://codecov.io/gh/jcoreio/superagent-verbose-errors)
[](https://github.com/semantic-release/semantic-release)
[](http://commitizen.github.io/cz-cli/)include response body in superagent errors for failed requests
## Usage
```sh
npm install --save superagent superagent-use superagent-verbose-errors
```To make any superagent request that fails append the response body to
its error message:
```js
const superagent = require('superagent-use')(require('superagent'))
superagent.use(require('superagent-verbose-errors'))
```To only include the response body for certain errors:
```js
const superagent = require('superagent-use')(require('superagent'))
superagent.use(require('superagent-verbose-errors')({
filter: res => res.status === 400
}))
```