You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
Better error messages are important to the overall usability of react. What is needed to make that a priority?
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.
The text was updated successfully, but these errors were encountered:
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
Better error messages are important to the overall usability of react. What is needed to make that a priority?
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.
The text was updated successfully, but these errors were encountered: