-
Notifications
You must be signed in to change notification settings - Fork 0
example enum error #52
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Summary of Changes
Hello @dentiny, 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!
I've refactored the IcebergMessage variant within the Error enum to provide more detailed error information. This change specifically adds a location field alongside the existing error message, enhancing error reporting by including the source location where the error originated. This improves the debuggability and clarity of error messages related to Iceberg operations.
Highlights
- Error Enum Refactoring: The
IcebergMessagevariant in theErrorenum has been changed from a simple string tuple (IcebergMessage(String)) to a struct-like variant (IcebergMessage { message: String, location: Location }). This allows for more structured error data. - Error Instantiation Update: The code that creates
IcebergMessageerrors, specifically intable_handler.rswhen failing to create an Iceberg snapshot, has been updated to use the new struct-like syntax, including thelocation!()macro for capturing the source location.
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 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 or fill out our survey 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.
Footnotes
-
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. ↩
There was a problem hiding this 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 aims to add location information to the Error::IcebergMessage enum variant. However, the current implementation introduces compilation errors because the Location type is not defined and the location! macro is not in scope. I've provided suggestions to use std::panic::Location and std::panic::Location::caller() to resolve these issues. Please note that using std::panic::Location::caller() requires annotating the enclosing function with #[track_caller].
| #[error("Iceberg error: {0}")] | ||
| IcebergMessage(String), | ||
| #[error("Iceberg error: {message}")] | ||
| IcebergMessage { message: String, location: Location, }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The type Location is not defined or imported in this scope. This will cause a compilation error. You probably meant to use std::panic::Location. Note that std::panic::Location has a lifetime parameter, which should typically be 'static when using Location::caller().
| IcebergMessage { message: String, location: Location, }, | |
| IcebergMessage { message: String, location: std::panic::Location<'static>, }, |
| } | ||
| Err(e) => { | ||
| let err = Err(Error::IcebergMessage(format!("Failed to create iceberg snapshot: {e:?}"))); | ||
| let err = Err(Error::IcebergMessage { message: format!("Failed to create iceberg snapshot: {e:?}"), location: location!(), )); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The location! macro is not a standard Rust feature and is not defined in this scope, which will cause a compilation error. You likely intend to use std::panic::Location::caller() to get the caller's location. Note that using std::panic::Location::caller() requires the enclosing function (event_loop) to be annotated with #[track_caller].
| let err = Err(Error::IcebergMessage { message: format!("Failed to create iceberg snapshot: {e:?}"), location: location!(), )); | |
| let err = Err(Error::IcebergMessage { message: format!("Failed to create iceberg snapshot: {e:?}"), location: std::panic::Location::caller(), }); |
Summary
Briefly explain what this PR does.
Related Issues
Closes # or links to related issues.
Changes
Checklist