Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Catch and handle NetworkError when attempting to fetch resource #384

Open
csarven opened this issue Mar 4, 2024 · 0 comments
Open

Catch and handle NetworkError when attempting to fetch resource #384

csarven opened this issue Mar 4, 2024 · 0 comments

Comments

@csarven
Copy link
Member

csarven commented Mar 4, 2024

When there is a network error, e.g., TCP handshake didn't occur, handle it properly all the way to the UI informing the user, e.g., "the thing you are trying to communicate with is unavailable (taking a bath), try again later or check the cables in the ocean."

A fetch's catch may only have error.message or error.stack. See also console.dir(error).

Not sure if error.message is standardised in any way, but cursory check with Firefox and Brave shows:

  • "NetworkError when attempting to fetch resource."
  • "Failed to fetch"

Stack doesn't seem to provide anything particularly useful.

Perhaps generally check if there is no error.response or error.status?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant