Don't throw error / catch on 400-level responses
See original GitHub issueInstead, limit the error/catch to 500-level errors. 400-level responses can be completely valid, expected, desired, etc.
I have been following this pattern with my bunyan logging – logging 400-level responses as warnings, and 500-level responses as errors. The idea is that a successful npm test
(which may expect 400-level responses) should show zero logging errors.
Issue Analytics
- State:
- Created 9 years ago
- Reactions:65
- Comments:17 (2 by maintainers)
Top Results From Across the Web
FAQ: how do I stop axios from throwing an error on 4XX / 5XX ...
By default, the axios HTTP library throws an error anytime the destination server responds with a 4XX / 5XX error (for example, a...
Read more >Axios 400 error request call then instead of catch
I found the solution. Problem caused by dont return promise in axios interceptors: axios.interceptors.response.use((response) => { return ...
Read more >How to catch the body of an AXIOS error - DEV Community
this doesn't help me, I have api that returns 400 as bad request, with a body, I can't read the body from response...
Read more >How to Fix a 400 Bad Request Error (Causes and Fixes) - Kinsta
1. URL String Syntax Error. The HTTP error 400 can occur due to incorrectly typed URL, malformed syntax, or a URL that contains...
Read more >400 Bad Request Error: What It Is and How to Fix It
The 400 Bad Request Error is an HTTP response status code indicating that the server was unable to process the request sent by...
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 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
This has been added as a feature in
0.11.0
by use ofvalidateStatus
config option.@carlojacobs you can access error.response.data