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

Add network error message #1281

Merged
merged 6 commits into from
Apr 24, 2024
Merged

Add network error message #1281

merged 6 commits into from
Apr 24, 2024

Conversation

bgrgicak
Copy link
Collaborator

Fixes #1205

What is this PR doing?

It adds an error message for blueprint network errors.

What problem is it solving?

It will help users identify the root cause of blueprints failing.

How is the problem addressed?

By returning a custom error message with debug instructions.

Testing Instructions

Note: The error is currently displayed multiple times because of uncaught promises somewhere in the code.

@bgrgicak bgrgicak self-assigned this Apr 19, 2024
@bgrgicak bgrgicak requested a review from a team April 19, 2024 08:00
Comment on lines 231 to 234
Check if the URL is correct and the server is reachable.
If it's reachable, the server might be blocking the request.
Check the console and network for more information.
In case of a CORS error, you can try using a proxy server.
Copy link
Collaborator

@adamziel adamziel Apr 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we infer what type of error was that and provide a dedicated message outlining the next steps? For example:

  • If it's a network error – say your internet connection twitched and reloading the page should fix the issue.
  • If it's 404 – say file couldn't be found.
  • If it's 403 – say it's probably a private resource.
  • If it's a CORS error, provide a paragraph or two of text to explain it's a browser security thing, provide a link that explains what's CORS, say they need to move their file somewhere else, e.g. GitHub / raw.githubusercontent.com, link out to a resource explaining setting up CORS headers on their existing servers.

All of these came up in various chats. A good error message will provide the reader with an explanation and the next steps. Ideally the reader will have all they need and won't ask us any follow-up questions. If there are no good external reliable resources we could link to, we could add a doc page to link to.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fetch returns a type error when a network error occurs without details. This means we can't distinguish between different types of network errors.

404 is special so it will return a response and our code will return_Could not download_.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh bummer! Well, let's provide a longer writeup, then, to at least explain what to do next, even if that's just "Glance at your console, what do you see? 404? do X. CORS? do Y". It could even be a link to a documentation page.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated the message, let me know if it's still unclear.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now I understand what you mean by longer writeup 😄

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

Co-authored-by: Adam Zielinski <adam@adamziel.com>
raw.githubusercontent.com instead. Here's how to do that:
1. Start with the original GitHub URL for the file. For example:
```
Copy link
Collaborator

@adamziel adamziel Apr 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ooops, this terminates a string and I broke the JS syntax :D

@bgrgicak bgrgicak merged commit fe814ae into trunk Apr 24, 2024
5 checks passed
@bgrgicak bgrgicak deleted the add/1205-network-error-message branch April 24, 2024 05:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants