How to handle FetchError?
See original GitHub issueHe there,
Thank you for creating these hooks, they are really useful for me.
One thing I noticed is when a request returns 404, an additional message propagates to console:
Uncaught (in promise) FetchError: Not Found
at createFetchError
Is there a way to efficiently handle FetchError and avoid error message propagation in console?
Issue Analytics
- State:
- Created 4 years ago
- Comments:9 (6 by maintainers)
Top Results From Across the Web
Handling Failed HTTP Responses With fetch() - TJ VanToll
Per MDN, the fetch() API only rejects a promise when a “network error is encountered, although this usually means permissions issues or similar....
Read more >Error handling while using native fetch API in JavaScript
First lets see, without handling errors,. fetch(url) .then(response => { return response.json(); }) .then(jsonResponse => { // do whatever you ...
Read more >Fetch: reject promise and catch the error if status is not OK?
Fetch promises only reject with a TypeError when a network error occurs. Since 4xx and 5xx responses aren't network errors, there's nothing to...
Read more >When That's Not So Fetch: Error Handling With fetch()
When errors are encountered during a fetch() call, it is often necessary to halt the compiler from reading the next few lines of...
Read more >node-fetch/ERROR-HANDLING.md at main - GitHub
A light-weight module that brings the Fetch API to Node.js - node-fetch/ERROR-HANDLING.md at main · node-fetch/node-fetch.
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
@dai-shi seems working now. Thanks!
Published: https://www.npmjs.com/package/react-hooks-async/v/3.9.0
Thanks for your contribution.