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');
const error = new AxiosError(errorThrownByAxios);
const error = new AxiosError(message, errorThrownByAxios);
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);
console.log(error.stack);
console.log(error.config);
console.log(error.request);
console.log(error.response);