Skip to content

Fix: Improve error message for download failures #1311

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

Closed
wants to merge 1 commit into from

Conversation

fannheyward
Copy link
Owner

When downloading rust-analyzer fails, the previous error message displayed to you was generic:
"Download rust-analyzer failed, you can get it from https://github.com/rust-analyzer/rust-analyzer"

This change enhances the error message by including the specific error details from the exception caught during the download process. The new message format is:
"Download rust-analyzer failed: . You can get it from https://github.com/rust-analyzer/rust-analyzer"

This provides you with more actionable information if a download error occurs, helping you diagnose the issue (e.g., network problems, file system permissions).

When downloading rust-analyzer fails, the previous error message
displayed to you was generic:
"Download rust-analyzer failed, you can get it from https://github.com/rust-analyzer/rust-analyzer"

This change enhances the error message by including the specific
error details from the exception caught during the download process.
The new message format is:
"Download rust-analyzer failed: <specific error message>. You can get it from https://github.com/rust-analyzer/rust-analyzer"

This provides you with more actionable information if a download
error occurs, helping you diagnose the issue (e.g., network problems,
file system permissions).
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Hello @fannheyward, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

Summary of Changes

Hello team, gemini-code-assist here to provide a summary of this pull request. This PR, authored by fannheyward, aims to enhance the user experience when the rust-analyzer download fails. Previously, the error message was generic, simply stating that the download failed. This change modifies the error handling in the download process to capture the specific error details from the exception that occurred and include them directly in the error message displayed to the user. This provides much more actionable information, helping users diagnose the root cause of the download failure, such as network issues or permission problems.

Highlights

  • Improved Error Messaging: The primary change is to make the error message displayed upon a failed rust-analyzer download more informative by including the specific error details from the underlying exception.

Changelog

  • src/index.ts
    • Modified the catch block within the activate function to extract the error message from the caught exception (e).
    • Updated the error message string (msg) to include the specific error message obtained from the exception, using a template literal.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.


Download fails, a sad sight,
Error message brings the light.
See the cause, clear the way,
Code works fine another day.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request significantly improves the error reporting for rust-analyzer download failures by including specific error messages. The approach taken to extract the message from the error object is clear and handles both Error instances and other types of thrown values. This will provide users with more actionable information when troubleshooting download issues. Well done!

Summary of Findings

  • Error Message Specificity for Non-Error Objects: The use of String(e) for non-Error instances is a good fallback. However, if e is a plain object without a custom toString() method, String(e) might resolve to "[object Object]", which isn't very informative. While common error sources usually provide better string representations or are Error instances, a more robust (though more verbose) handling could involve checking for a message property even on non-Error objects. This was considered a low-severity point and thus not commented on directly due to review settings, as the current implementation is already a good improvement.
  • Clarity of msg variable re-assignment: The variable msg is declared in an outer scope (line 20) and then re-assigned within this catch block. For slightly improved clarity and encapsulation, the full error message string could be constructed and passed directly to window.showErrorMessage without re-assigning the outer msg. This is a minor stylistic observation and considered low-severity, hence not commented on directly due to review settings.

Merge Readiness

The changes in this pull request are a clear improvement to error handling and provide better feedback to the user. No critical, high, or medium severity issues were found in the introduced changes. The code is well-written and achieves its stated goal effectively. While I am not authorized to approve pull requests, based on this review, the changes appear to be in good shape for merging. It's always recommended to have another pair of eyes review and approve before merging.

@fannheyward
Copy link
Owner Author

Jules test.

@fannheyward fannheyward deleted the improve-download-error-message branch July 10, 2025 01:30
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.

1 participant