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

Improved error messages and also a question/comment about fetch #783

Open
clarky07 opened this issue May 2, 2024 · 0 comments
Open

Improved error messages and also a question/comment about fetch #783

clarky07 opened this issue May 2, 2024 · 0 comments

Comments

@clarky07
Copy link

clarky07 commented May 2, 2024

Introduction

Error messages leave something to be desired as has been noted in several other issues. [TypeError: Network request failed] doesn't give much to go on. If we could get more information about what failed that would be helpful

Details

I just spent most of a day on an extremely silly typo error on my part. Frustrating mistake to make, but I accidentally had an extraneous space at the front of a url. This caused fetch to fail with the above error. I was printing out the url i was sending, and it was working everywhere else i tried it (i.e. browser, curl, postman, etc). It wasn't obvious in the console logs that there was a space in front of it.

Feels like an error more like "incorrectly formatted url" or something of that nature should be possible and would be preferable.

As a side note to generally improving error messaging, would there be any drawbacks I'm not thinking of to adding a simple .trim() to the fetch api itself? it feels like it really should have been able to handle this particular error out of the box.

Discussion points

  1. Better error messages are important to the overall usability of react. What is needed to make that a priority?

  2. Are there any downsides to adding .trim() to the url passed into fetch to handle this particularly silly edge case without the need for better error messages.

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

No branches or pull requests

1 participant