You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi @Bomberlt, I see you're using return when using axios(). You're handling the promise in the .then and catch blocks inside the function. Are you attaching another then or catch on the returned value?
example
// some api service
function getList() {
return axios.get('http://google.com');
}
function init() {
getList()
.then()
.catch();
}
Maybe the issue happens when doing
// some api service
function getList() {
return axios.get('http://google.com')
.then()
.catch();
}
}
function init() {
getList()
.then()
.catch();
}
When using axios-cancel and http response is 401 error (I think the same for all 4xx) "Potentially unhandled rejection [15] Error" occurs.
The problem that error does not get to the .catch():
axio-cancel debug log:
adding request
1
index.js:1 adding request '1484560946801' xhr.js:175 POST http://..../... 401 (Unauthorized) dispatchXhrRequest @ xhr.js:175 xhrAdapter @ xhr.js:12 dispatchRequest @ dispatchRequest.js:52 unhandledRejection.js:23 Potentially unhandled rejection [1] Error: Request failed with status code 401 at createError (http://..../index-1484560715206.js:24790:16) at settle (http://..../index-1484560715206.js:24762:13) at XMLHttpRequest.handleLoad (http://..../index-1484560715206.js:24638:8) (anonymous) @ unhandledRejection.js:23 report @ unhandledRejection.js:50 flush @ unhandledRejection.js:72
index.js:1 removing request
1
P.S. I'm new to javascript so maybe it could be my mistake, I could add more context if needed.
The text was updated successfully, but these errors were encountered: