feat(localization): global exception handling restructuring and localization support#2
Merged
Merged
Conversation
EdoTXp
commented
May 27, 2026
Owner
- Standardized exceptions across Auth, LocalDatabase, Platform, and RestClient layers.
- Implemented dynamic localization for all error codes and notification channels.
- Refactored directory structures and updated imports across multiple feature packages.
- Updated unit and integration tests to verify localized error string keys.
…ndling - Removed BookException and BookNotFoundException classes. - Introduced RestClientException to handle various error scenarios. - Updated GoogleBooksDataSourceImpl, RemoteBooksRepositoryImpl, and DioRestClientImpl to throw RestClientException. - Modified BookBloc to emit BookErrorState with error codes and messages. - Updated tests to reflect changes in error handling and exception types. - Added RestClientErrorCode enum and its extension for localized error messages.
…better readability
- Added `clearUserData` method to `AuthRepository` and its implementation in `AuthRepositoryImpl`. - Updated `AuthServiceImpl` to clear user data upon sign-out. - Modified error handling in `BookBloc` to use `errorDescriptionMessage` instead of `errorMessage`. - Refactored tests for `AuthServiceImpl` and `ProfileBloc` to accommodate changes in error handling and user data clearing. - Updated localization message handling in `RestClientErrorCodeExtension`. - Adjusted various state management classes and events to ensure consistency in error message handling. - Incremented version number in `pubspec.yaml` to 2.11.1.
- Replaced UserThemeBloc with UserThemeCubit for better state management. - Introduced UserLoggedCubit to manage user authentication state. - Added UserNotificationCubit to handle notification initialization. - Updated BookifyApp to utilize new Cubits for theme, user authentication, and notifications. - Renamed clearUserData method to deleteUserModel in AuthRepository and its implementation. - Enhanced AuthService to include userIsLoggedIn method for checking authentication status. - Updated tests to cover new Cubit implementations and refactored existing tests for clarity. - Removed obsolete UserThemeBloc test file. - Bumped version to 2.11.2 in pubspec.yaml.
…ion to 2.11.3 Co-authored-by: Copilot <copilot@github.com>
…n and storage - Added AuthErrorCode enum to categorize authentication errors. - Added StorageErrorCode enum to categorize storage-related errors. - Implemented AuthErrorCodeExtension for localized error messages based on AuthErrorCode. - Implemented StorageErrorCodeExtension for localized error messages based on StorageErrorCode. - Updated various test files to utilize new error handling mechanisms, ensuring proper exception handling and message verification. Co-authored-by: Copilot <copilot@github.com>
- Changed error code from `writeFailed` to `invalidValue` in `user_page_reading_time_repository_impl.dart`. - Updated error handling in `programming_reading_bloc.dart` to use `StorageErrorCode` for better error categorization. - Refactored error handling in `reading_page_timer_bloc.dart` and `user_theme_cubit.dart` to utilize `StorageErrorCode` for consistent error messaging. - Modified state classes in `programming_reading_state.dart` and `reading_page_timer_state.dart` to include error code and description. - Updated UI components to display localized error messages based on error codes. - Adjusted localization in `pt_BR.json` for better clarity in user prompts. - Improved code formatting and readability in various files. - Bumped version to 2.11.5 in `pubspec.yaml`.
- Correct terms and privacy links in AuthPage
- Simplified error mapping in LocalDatabaseImpl by removing unnecessary checks for specific error types. - Updated LocalDatabaseErrorCode to include operationFailed and removed unused error codes. - Modified BookDetailBloc, BookOnBookcaseDetailBloc, BookcaseBloc, and other relevant blocs to use operationFailed for error handling. - Introduced BookcaseBooksEmptyReason and BookcaseInsertionSuccessReason enums for better state management and localization. - Updated UI components to reflect changes in state and display localized messages for success and error scenarios. - Adjusted tests to align with the new state management and localization structure.
- Added NotificationChannelExtension for better localization of channel descriptions and labels. - Enhanced NotificationsServiceImpl to use localized labels for notification channels. - Updated ProgrammingReadingBloc to use localized notification titles and bodies. - Adjusted InsertedHourTimeEvent to include notification title and body. - Updated ProgrammingReadingPage to pass localized notification messages. - Updated pubspec.yaml and pubspec.lock for dependency version upgrades. - Added tests for new notification title and body handling in programming reading bloc.
…ted event handling
- Introduced PlatformException class to standardize error handling. - Added PlatformErrorCode enum for categorizing platform-related errors. - Enhanced error handling in AppVersionService, ContactsService, LauncherService, NotificationsService, PlayAlarmSoundService, and UserNotificationCubit. - Updated AboutBloc, ContactsPickerBloc, LoanBloc, LoanDetailBloc, LoanInsertionBloc, NotificationsBloc, and ProgrammingReadingBloc to emit detailed error states. - Implemented localized error messages using PlatformErrorCodeExtension. - Updated tests to reflect changes in error handling logic.
- Removed old error code extension files for auth, local database, platform, REST client, and storage errors. - Created new error code extension files under a unified error code directory structure. - Updated import paths in various feature files to reflect the new error code structure. - Modified error handling in the readings timer bloc to utilize the new error code extensions for better localization support. - Updated tests to check for localized error messages instead of hardcoded strings. - Bumped version number to 2.11.12 in pubspec.yaml.
Bypass Kotlin JVM target validation in gradle.properties to unblock the release build. This is a temporary workaround due to an inconsistency between Java (11) and Kotlin (17) tasks inside the 'flutter_facebook_auth' plugin. The validation will be re-enabled once the plugin is updated.
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.