Add specific message for network errors on app launch (Web UI)#25527
Add specific message for network errors on app launch (Web UI)#25527gabrielcorado merged 5 commits intomasterfrom
Conversation
| let statusText = 'Something went wrong'; | ||
| if (err instanceof Error) { | ||
|
|
||
| if (err instanceof TypeError) { |
There was a problem hiding this comment.
I'm no expert but TypeError seems broad. Would be it better to check if the error text is "Failed to fetch" like what we see is being returned in this case?
@ryanclark @kimlisa I'll defer to you on this one.
There was a problem hiding this comment.
roman has a point b/c there could be other TypeError's like accessing a field in an undefined variable (seems unlikely though), however different browsers will have different error messages for network errors. tested them out:
chrome: failed to fetch
firefox: network error when attempting to fetch resource.
safari: load failed
so i think the way it is okay, as long as we are aware it could mean something else which the web console will print out the real error
There was a problem hiding this comment.
or we could just add the real error message err.message along with the status text
kimlisa
left a comment
There was a problem hiding this comment.
after addressing roman's comment
| let statusText = 'Something went wrong'; | ||
| if (err instanceof Error) { | ||
|
|
||
| if (err instanceof TypeError) { |
There was a problem hiding this comment.
roman has a point b/c there could be other TypeError's like accessing a field in an undefined variable (seems unlikely though), however different browsers will have different error messages for network errors. tested them out:
chrome: failed to fetch
firefox: network error when attempting to fetch resource.
safari: load failed
so i think the way it is okay, as long as we are aware it could mean something else which the web console will print out the real error
Co-authored-by: Roman Tkachenko <roman@goteleport.com>
|
@r0mant I've updated the message (attached an image on the PR description to see how it looks on the page). I couldn't add a link to the error message because the component accepts only text. I'm not sure if we want to update it to have a |
|
@gabrielcorado See the table below for backport results.
|
Related to #24255.
This PR changes the error
Failed to fetchreturned when launching an application (from Web UI) with a more specific message that can help users better understand why it is failing.The error cause is better described on the issue:
Screenshot of how the page will look after the change.