.catch transformRequest / transformResponse errors
See original GitHub issueI might be missing something here (saw #61 and #110 related), but…
Looks like there’s no way to .catch
in the Promise control flow any error occurring during the transform phase, e.g. here: https://github.com/mzabriskie/axios/blob/master/lib/adapters/xhr.js#L12-L17 you’d need to try {} catch {}
transformData()
and reject
accordingly the Promise
Is this deliberate?
I think It’s ok to have your own error handlers in transformResponse
like you say here: https://github.com/mzabriskie/axios/issues/110#issuecomment-142682301 , but what if the user wants to handle errors down the Promise chain? (In my experience this is the expected way of handling errors when dealing with a Promise-based api)
Issue Analytics
- State:
- Created 8 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
error when try to get data from json angular - Stack Overflow
In your code, $scope.experiences is the promise object and return response.data; is returning to nothing. You need to use the promise object ...
Read more >axios error bad request | The AI Search Engine You Control
A conventional approach is to catch errors in the catch() block like below: axios.get('/api/xyz/abcd') .catch(function (error) { if (error.response) ...
Read more >How to Perform HTTP Requests with Axios – A Complete Guide
To obtain the response and catch any errors, we must utilize the then() and ... two config options: transformRequest and transformResponse, ...
Read more >Axios Cheat Sheet - Kapeli - Dash for macOS
Make a request for a user with a given ID axios.get('/user?ID=12345') .then(function (response) { console.log(response); }) .catch(function (error) ...
Read more >Post User Registration Action ERROR - Auth0 Community
But using string interpolation always results in an error! ... .catch(err => { console.log(err); console.log('Got here') }); };. Full Error ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Can we reopen this issue? I just stumbled upon this as well. Promise-based api should handle all errors as reject or at least provide a mechanism for the user to call reject. With the current api I have to do this
Which is not ideal.
This was solved after a refactor a few versions ago.