question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Pass response on error when available

See original GitHub issue

For 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:closed
  • Created 6 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
binkicommented, Aug 20, 2017

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!

0reactions
sheaiveycommented, Nov 15, 2017

v2.0.0 addresses this change. Now when an error occurs response will contain the err.response object.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found