Pass response on error when available
See original GitHub issueFor many error conditions, such as server reporting failure in its response, you still get a response from the server with data. See how to get the response in this situation.
I think react-axios should also pass in response when there is an error condition. It doesn’t look like it does currently.
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Best Practices for REST API Error Handling - Baeldung
The simplest way we handle errors is to respond with an appropriate status code. Here are some common response codes: 400 Bad Request...
Read more >How to get Readable error response from JavaScript Fetch API?
I first check if the response is ok, and then generate the error from the response.text() only for the cases that we have...
Read more >Error handling - Express.js
For errors returned from asynchronous functions invoked by route handlers and middleware, you must pass them to the next() function, where Express will ......
Read more >Handling Errors | Axios Docs
{ // The request was made and the server responded with a status code // that falls out of the range of 2xx...
Read more >REST API Error Handling in Go: Behavioral Type Assertion
Use HTTP response status codes to indicate something went wrong (400 Bad Request, 404 Not Found…). Although there are different status codes ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top 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

Ah. I didn’t make that connection even though I looked at that exact line of code, I can get to the response in my handler after all. Thanks for the help!
v2.0.0 addresses this change. Now when an error occurs
responsewill contain theerr.responseobject.