Socket
Socket
Sign inDemoInstall

axios-error

Package Overview
Dependencies
3
Maintainers
3
Versions
37
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    axios-error

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


Version published
Weekly downloads
9K
decreased by-12.69%
Maintainers
3
Install size
610 kB
Created
Weekly downloads
 

Changelog

Source

1.0.4 / 2021-01-11

  • deps: bump axios.

Readme

Source

axios-error

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

Installation

npm i --save axios-error

or

yarn add axios-error

Usage

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:

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

Keywords

FAQs

Last updated on 11 Jan 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc