Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

axios-error

Package Overview
Dependencies
Maintainers
3
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

axios-error

An axios error wrapper that aim to provide clear error message to the user

  • 0.7.18
  • Source
  • npm
  • Socket score

Version published
Maintainers
3
Created
Source

axios-error

An axios error wrapper that aim to provide clear error message to the user

Installation

npm i --save axios-error

or

yarn add axios-error

Usage

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

// You can construct it from error throw by axios
const error = new AxiosError(errorThrowByAxios);

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

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

Directly console.log on the error instance will return formatted message. If you'd like to get the axios request, response, or config, you can still get them via those 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

Package last updated on 08 Apr 2020

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc