Registry / testing / axios-error

axios-error

JSON →
library1.0.4jsnpmunverified

Axios error wrapper that provides structured and human-readable error messages for HTTP requests made with Axios. Version 1.0.4 is the latest stable release; the package is mature with low release cadence. It wraps raw Axios errors, extracting config, request, and response objects for debugging. Differentiator: built-in formatted output via console.log, TypeScript typings included. Supports Node >=8. Part of the Yoctol messaging-apis monorepo.

npm install axios-error
INSTALL
IMPORT
SIG · AXIOS-ERROR
A
axios-error
testingjavascriptv1.0.4
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

AxiosError
const { AxiosError } = require('axios-error')
const AxiosError = require('axios-error')
CommonJS: named export. ES import: import { AxiosError } from 'axios-error'
AxiosError
import { AxiosError } from 'axios-error'
import AxiosError from 'axios-error'
ESM: named export, not default. TypeScript types included.

Shows wrapping an Axios error and accessing the formatted message and response status.

const { AxiosError } = require('axios-error'); const axios = require('axios'); async function makeRequest() { try { await axios.get('https://api.example.com/data'); } catch (err) { const wrapped = new AxiosError(err); console.log(wrapped); console.log(wrapped.response?.status); return wrapped; } } makeRequest();
Debug
Known issues
breakingRequires Node >=8; no longer works on older Node versions.
fix
Upgrade Node to version 8 or above.
affects: >=1.0.0
breakingImport was CJS default export in pre-1.0 versions; now is named export.
fix
Use const { AxiosError } = require('axios-error') or import { AxiosError } from 'axios-error'.
affects: >=1.0.0
gotchaIf error thrown is not from Axios, constructor may behave unexpectedly.
fix
Check error.isAxiosError before wrapping, or handle generic errors separately.
affects: >=0.0.0
Errors
Common errors & fixes
TypeError: AxiosError is not a constructor
Using default import instead of named import.
fix
Use `const { AxiosError } = require('axios-error')` or `import { AxiosError } from 'axios-error'`.
Cannot find module 'axios-error'
Package not installed or module resolution issue.
fix
Run `npm install axios-error` or check your node_modules path.
Upgrade
Version history
1.0.4latest on npm
Audit
Dependencies
axiosrequiredPeer dependency — wraps errors thrown by Axios
Agent activity
22 hits · last 30 days
node
20
OpenAI (training)
1
Resources
axios-error — npm install axios-error · libregistry