mirror of
https://github.com/tenrok/axios.git
synced 2026-06-14 18:42:33 +03:00
Refactored AxiosError to a constructor;
Refactored `Cancel` to a constructor, a subclass of the `AxiosError`; Expose CanceledError class; Refactored axios error codes; Added `toFlatObject` util;
This commit is contained in:
+2
-2
@@ -2,7 +2,7 @@
|
||||
|
||||
var utils = require('./utils');
|
||||
var normalizeHeaderName = require('./helpers/normalizeHeaderName');
|
||||
var enhanceError = require('./core/enhanceError');
|
||||
var AxiosError = require('./core/AxiosError');
|
||||
|
||||
var DEFAULT_CONTENT_TYPE = {
|
||||
'Content-Type': 'application/x-www-form-urlencoded'
|
||||
@@ -90,7 +90,7 @@ var defaults = {
|
||||
} catch (e) {
|
||||
if (strictJSONParsing) {
|
||||
if (e.name === 'SyntaxError') {
|
||||
throw enhanceError(e, this, 'E_JSON_PARSE');
|
||||
throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, this.response);
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user