fix(ripgrep): surface network errors as RipgrepDownloadFailedError#21748
Closed
YGoetschel wants to merge 1 commit intoanomalyco:devfrom
Closed
fix(ripgrep): surface network errors as RipgrepDownloadFailedError#21748YGoetschel wants to merge 1 commit intoanomalyco:devfrom
YGoetschel wants to merge 1 commit intoanomalyco:devfrom
Conversation
When fetch() throws (e.g. offline/no network), the raw runtime error was bubbling up, showing the confusing 'Unable to connect' message in the TUI rather than a meaningful error. Catching the network exception and rethrowing as DownloadFailedError lets the LLM and user understand what actually went wrong.
Contributor
|
The following comment was made by an LLM, it may be inaccurate: Potential Duplicate Found:
Recommendation: Check if PR #21649 is still open and if it covers the same scope (converting fetch errors to |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue for this PR
Closes #21646
Type of change
What does this PR do?
fetch(url)can throw when the machine is offline or can't reach GitHub — but the error was not caught. The raw Bun/Node network exception propagated up, surfacing in the TUI as the unhelpful message "Unable to connect. Is the computer able to access the url?".DownloadFailedErroralready exists for exactly this case but was only used for non-2xx HTTP responses. This change adds a.catch()that converts fetch network errors intoDownloadFailedErrorwithstatus: 0, so both paths (network failure and bad HTTP status) produce the same typed error.How did you verify your code works?
Code review — the fix is minimal and follows the existing error pattern. In an offline environment, the
fetch()promise rejects and the catch converts it toDownloadFailedError.Screenshots / recordings
No UI screenshots — error message improvement in tool output.
Checklist