-
Notifications
You must be signed in to change notification settings - Fork 0
Debug integrate proper exceptions l10n messages #28
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
Debug integrate proper exceptions l10n messages #28
Conversation
Adds the HtUiKitLocalizations delegate to the MaterialApp configuration. This makes the shared, localized error strings from the UI kit package available throughout the dashboard application, preparing it for the refactoring of error handling logic.
Updates the authentication pages (`authentication_page`, `request_code_page`, `email_code_verification_page`) to display localized error messages. - Modifies the `BlocConsumer` listeners to use the `exception` field from the `AuthenticationState`. - Uses the `toFriendlyMessage(context)` extension method from the `ht_ui_kit` package to render user-friendly error messages in SnackBars.
Refactors `AuthenticationState` to replace the `errorMessage` string with a `HtHttpException` object named `exception`. This change is necessary to support the new `ht_ui_kit` package, which provides a `toFriendlyMessage` extension on `HtHttpException` for displaying localized error messages. Storing the full exception object in the state allows the UI layer to access it directly and use the extension, ensuring consistent and localized error handling.
Updates `AuthenticationBloc` to handle and emit `HtHttpException` objects instead of raw error strings. - All `catch` blocks now store the caught exception in the `exception` field of the `AuthenticationState`. - The manual email validation check is removed, as this logic is now handled by the `InvalidInputException` from the repository layer. - Generic `catch (e)` blocks now wrap the error in a `UnknownException` to ensure all failures are propagated as a standard exception type.
Updates `AuthenticationBloc` to handle and emit `HtHttpException` objects instead of raw error strings. - All `catch` blocks now store the caught exception in the `exception` field of the `AuthenticationState`. - The manual email validation check is removed, as this logic is now handled by the `InvalidInputException` from the repository layer. - Generic `catch (e)` blocks now wrap the error in a `UnknownException` to ensure all failures are propagated as a standard exception type.
Updates the `RequestCodePage` to use the `toFriendlyMessage` extension from `ht_ui_kit`. The `BlocConsumer` now accesses the `exception` object from the `AuthenticationState` and passes it to the extension method to display a user-friendly, localized error message in the `SnackBar`. The `buildWhen` condition is also updated to react to changes in the `exception` field.
Updates the `AuthenticationPage` to use the `toFriendlyMessage` extension from `ht_ui_kit`. The `BlocConsumer` now accesses the `exception` object from the `AuthenticationState` and passes it to the extension method to display a user-friendly, localized error message in the `SnackBar`. A `debugPrint` statement was temporarily added to diagnose a context-related issue with the localization, which is now resolved.
…ion and friendly messages
- Changed `errorMessage` to `exception` in `CreateHeadlineState`. - Updated `exception` type to `HtHttpException`. - Improved error handling and reporting.
- Changed `errorMessage` to `exception` in `CreateSourceState`. - Updated `exception` type to `HtHttpException`. - Improved error handling and information.
- Replaced errorMessage with exception - Handle unexpected errors gracefully - Improved error message clarity
- Changed `errorMessage` to `exception` in `CreateTopicState`. - Updated `exception` type to `HtHttpException`. - Improved error handling and reporting.
- Changed `errorMessage` to `exception` in `EditHeadlineState`. - Updated `exception` type to `HtHttpException`. - Updated `props` list in `EditHeadlineState`.
- Changed `errorMessage` to `exception` in `EditSourceState`. - Updated `exception` type to `HtHttpException`. - Improved error handling and reporting.
- Replaced errorMessage with exception in states - Improved error handling in CreateSourceBloc - Improved error handling in EditTopicBloc - Updated exception handling for better clarity - Used HtHttpException for specific error types
- Replaced errorMessage with exception property. - Improved error reporting for unexpected errors. - Handle cases where original source data is missing.
- Replaced errorMessage with exception property. - Improved error handling for unexpected exceptions. - Added UnknownException for better error reporting.
- Replaced errorMessage with exception in state - Improved error wrapping for better context - Handle unexpected errors more gracefully
- Show more informative error messages. - Use exception's friendly message. - Improve FailureStateWidget display.
- Use exception's friendly message for better user feedback. - Updated error display in FailureStateWidget.
- Replaced generic error message with more informative one. - Used `toFriendlyMessage` for better user experience.
- Show more informative error messages. - Use exception's friendly message. - Improved FailureStateWidget usage.
- Use exception's friendly message. - Show more informative error messages.
- Replaced errorMessage with exception property. - Handle unexpected errors gracefully. - Improved error reporting clarity.
- Added HTUIKit dependency to create_headline_page.dart
- Added ht_ui_kit import.
- Use exception's friendly message in SnackBar. - Display exception in FailureStateWidget.
- Changed `errorMessage` to `exception` - Improved error handling clarity - Uses HtHttpException for error type
- Replaced generic error message. - Now shows the specific exception. - Improves error handling clarity.
- Replaced errorMessage with exception property - Improved error handling for all bloc events - Used UnknownException for unexpected errors
- Replaced generic error message. - Now shows specific exception details.
- Replaced generic error message. - Now shows specific exception. - Improves error handling clarity.
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 @fulleni, 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!
This pull request refines the application's error management system by introducing a robust, exception-driven approach for handling and displaying errors. The core change involves replacing generic error messages with specific exception objects, which are then used to generate localized, user-friendly feedback in the UI. This enhances both the developer experience for debugging and the end-user experience by providing clearer explanations for issues.
Highlights
- Enhanced Error Handling: The application's error handling has been significantly improved by transitioning from simple string-based error messages to a more structured approach using
HtHttpException
objects. This allows for more precise error identification and handling. - Localized Error Messages: Integrated the
ht_ui_kit
package to provide user-friendly and localized error messages. UI components now leverage an extension method (toFriendlyMessage
) onHtHttpException
to display context-aware error feedback. - BLoC State Management Update: All relevant BLoC states (
AppConfigurationState
,AuthenticationState
,ContentManagementState
,CreateHeadlineState
,CreateSourceState
,CreateTopicState
,EditHeadlineState
,EditSourceState
,EditTopicState
,DashboardState
,SettingsState
) have been updated to store anHtHttpException
object instead of a plainerrorMessage
string, enabling richer error information. - Centralized Failure Widget: The
FailureStateWidget
has been refactored to accept anHtHttpException
directly, streamlining the display of error states across the application and ensuring consistent localized messaging.
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.
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 introduces structured exception-based error handling and integrates localized messages, improving maintainability and user experience. The changes are well-applied across numerous BLoCs and UI components. I've left a few comments highlighting potential issues, including a possible misconfiguration in localization and some inconsistencies in state management logic that could lead to bugs. Once these are addressed, the PR will be in excellent shape.
Status
READY/IN DEVELOPMENT/HOLD
Description
Type of Change