Skip to content

Commit

Permalink
Change AxiosError creation to use AxiosError.from method
Browse files Browse the repository at this point in the history
  • Loading branch information
rstein committed Aug 10, 2022
1 parent 1d83731 commit a0cdb0f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@ function settle(resolve, reject, response, delay) {

function createAxiosError(message, config, response, code) {
// axios v0.27.0+ defines AxiosError as constructor
if (typeof axios.AxiosError === 'function') {
return new axios.AxiosError(message, code, config, null, response);
if (typeof axios.AxiosError === "function") {
return axios.AxiosError.from(new Error(message), code, config, null, response);
}

// handling for axios v0.26.1 and below
Expand Down

0 comments on commit a0cdb0f

Please sign in to comment.