# axios-error

> Axios error wrapper that aim to provide clear error message to developers

Latest version **1.0.4** (published 2021-01-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install axios-error
pnpm add axios-error
yarn add axios-error
bun add axios-error
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.4 |
| Published | 2021-01-11 |
| First published | 2017-10-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=8 |
| Dependencies | 2 |
| Unpacked size | 130.8 KB |
| Known vulnerabilities | 0 (+23 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 1937 |
| Maintainers | chentsulin, kpman, tw0517tw |
| Keywords | axios, error, http |

## Links

- npm: https://www.npmjs.com/package/axios-error
- Repository: https://github.com/Yoctol/messaging-apis
- Homepage: https://github.com/Yoctol/messaging-apis#readme
- Issues: https://github.com/Yoctol/messaging-apis/issues
- npm.io page: https://npm.io/package/axios-error

## Dependencies (2)

- [axios](https://npm.io/package/axios.md) ^0.21.1
- [type-fest](https://npm.io/package/type-fest.md) ^0.15.1

## Alternatives

- [@sentry/react-native](https://npm.io/package/@sentry/react-native.md) — 2.6M weekly downloads
- [@ardatan/aggregate-error](https://npm.io/package/@ardatan/aggregate-error.md) — 708.1K weekly downloads
- [custom-error-generator](https://npm.io/package/custom-error-generator.md) — 2.0K weekly downloads
- [@technik-sde/prosemirror-recreate-transform](https://npm.io/package/@technik-sde/prosemirror-recreate-transform.md) — 1.5K weekly downloads
- [@suchipi/error-utils](https://npm.io/package/@suchipi/error-utils.md) — 78 weekly downloads

## Recent versions

- 1.0.4 (latest) — 2021-01-11
- 1.0.0-beta.27 (next) — 2020-06-23
- 1.0.0 — 2020-09-07
- 1.0.0-beta.26 — 2020-06-16
- 1.0.0-beta.24 — 2020-06-11
- 0.7.18 — 2020-04-08
- 0.7.17 — 2020-04-08
- 1.0.0-beta.16 — 2020-04-06
- 1.0.0-beta.5 — 2019-11-22
- 1.0.0-beta.4 — 2019-11-22
- 1.0.0-beta.3 — 2019-11-22
- 1.0.0-beta.2 — 2019-11-19
- 1.0.0-beta.1 — 2019-11-16
- 1.0.0-alpha.2 — 2019-10-04
- 1.0.0-alpha.0 — 2019-09-11
- … 22 more at https://npm.io/package/axios-error/versions

## README

# axios-error

> Axios error wrapper that aim to provide clear error message to developers

## Installation

```sh
npm i --save axios-error
```

or

```sh
yarn add axios-error
```

<br />

## Usage

```js
const AxiosError = require('axios-error');

// You can construct it from the error thrown by axios
const error = new AxiosError(errorThrownByAxios);

// Or with an custom error message
const error = new AxiosError(message, errorThrownByAxios);

// Or construct it from axios config, axios request and axios response
const error = new AxiosError(message, { config, request, response });
```

Calling `console.log` on the error instance returns the formatted message. If you'd like to get the axios `request`, `response`, or `config`, you can still get them via the following keys on the error instance:

```js
console.log(error); // formatted error message
console.log(error.stack); // error stack trace
console.log(error.config); // axios request config
console.log(error.request); // HTTP request
console.log(error.response); // HTTP response
```

---
_Source: https://npm.io/package/axios-error · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
