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

fix: improve error message for request errors #199

Merged
merged 2 commits into from
Feb 16, 2023
Merged

Conversation

silverbackdan
Copy link
Contributor

The error message itself looks erroneous when the fetch fails without any request or response. Usually a network error. This can happen when a user disconnects from the internet or a fetch endpoint has an invalid ssl certfiicate.

Previously the message would be Failed to Fetch () with these empty brackets.

Simple refactor to build the message up in the order that the final string will be and include the brackets only if required.

Thanks for all your work on this project! It's great.

@silverbackdan
Copy link
Contributor Author

I've just added 1 more commit now which will still output the request URL if there was no response in brackets. Again, this is useful if the browser intercepted the response, the internet disconnects and such. The error message will still have the useful information about the endpoint that was trying to be fetched.

@pi0 pi0 changed the title Improve error message, removes empty brackets in message fix: improve error message Feb 16, 2023
@pi0 pi0 changed the title fix: improve error message fix: improve error message for request errors Feb 16, 2023
Copy link
Member

@pi0 pi0 left a comment

Choose a reason for hiding this comment

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

Thanks!

@pi0 pi0 merged commit dfbcf77 into unjs:main Feb 16, 2023
@silverbackdan
Copy link
Contributor Author

Most welcome @pi0 thanks for your work on OS.

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

Successfully merging this pull request may close these issues.

2 participants