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.

How to handle FetchError?

See original GitHub issue

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

github_iconTop GitHub Comments

1reaction
Alxblskcommented, Dec 2, 2019

@dai-shi seems working now. Thanks!

0reactions
dai-shicommented, Dec 2, 2019

Published: https://www.npmjs.com/package/react-hooks-async/v/3.9.0

Thanks for your contribution.

Read more comments on GitHub >

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

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