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 - npm Package Compare versions

Comparing version 0.7.8 to 0.7.11

3

lib/index.js

@@ -29,2 +29,5 @@ 'use strict';var _util = require('util');var _util2 = _interopRequireDefault(_util);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };}

this.response = response;
if (response && response.status) {
this.status = response.status;
}
}

@@ -31,0 +34,0 @@

4

package.json
{
"name": "axios-error",
"description": "An axios error wrapper that aim to provide clear error message to the user",
"version": "0.7.8",
"version": "0.7.11",
"engines": {

@@ -23,3 +23,3 @@ "node": ">=6"

},
"gitHead": "9bcc48ddb1c03d7fc0d883c5c8e0e5421cc3a505"
"gitHead": "8e43618226e9c46216372b813d24cae3bdf9ed9e"
}

@@ -0,1 +1,3 @@

import util from 'util';
import MockAdapter from 'axios-mock-adapter';

@@ -32,6 +34,19 @@ import axios from 'axios';

expect(error.inspect()).toMatchSnapshot();
expect(error[util.inspect.custom]()).toMatchSnapshot();
}
});
it('should set `.status` property', async () => {
try {
await axios.post('/', { x: 1 });
} catch (err) {
// overwrite because axios-mock-adapter set it to undefined
err.response.statusText = 'Bad Request';
const error = new AxiosError(err);
expect(error.status).toBe(400);
}
});
it('should work with construct using error instance only', async () => {

@@ -49,3 +64,3 @@ try {

expect(error.inspect()).toMatchSnapshot();
expect(error[util.inspect.custom]()).toMatchSnapshot();
}

@@ -67,3 +82,3 @@ });

expect(error.inspect()).toMatchSnapshot();
expect(error[util.inspect.custom]()).toMatchSnapshot();
}

@@ -76,3 +91,3 @@ });

expect(error.inspect()).toMatchSnapshot();
expect(error[util.inspect.custom]()).toMatchSnapshot();
});

@@ -29,2 +29,5 @@ import util from 'util';

this.response = response;
if (response && response.status) {
this.status = response.status;
}
}

@@ -31,0 +34,0 @@

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