Skip to content

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

Merged
merged 44 commits into from
Jul 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
ad99478
feat(l10n): integrate ht_ui_kit localizations
fulleni Jul 14, 2025
7ce06ee
refactor(auth): use localized exceptions in auth UI
fulleni Jul 14, 2025
c5552d8
feat(authentication): update state to use exception object
fulleni Jul 14, 2025
c2935df
feat(authentication): adapt bloc to handle HtHttpException
fulleni Jul 14, 2025
99ef00e
feat(authentication): adapt bloc to handle HtHttpException
fulleni Jul 14, 2025
bd710d1
feat(authentication): refactor request code page to use localized errors
fulleni Jul 14, 2025
ae27301
feat(authentication): refactor auth page to use localized errors
fulleni Jul 14, 2025
2094a7d
feat(dashboard): Update Dashboard State to handle HtHttpException
fulleni Jul 14, 2025
e85579e
feat(dashboard): Update DashboardBloc to emit HtHttpException
fulleni Jul 14, 2025
49f1f03
feat(shared): Refactor FailureStateWidget to accept HtHttpException
fulleni Jul 14, 2025
1fa01ba
feat(dashboard): Update DashboardPage to pass HtHttpException to Fail…
fulleni Jul 14, 2025
e482de2
feat(app_config): Refactor AppConfigurationState to use HtHttpExcepti…
fulleni Jul 14, 2025
99bfb96
refactor(app_config): Refactor AppConfigurationState to use HtHttpExc…
fulleni Jul 14, 2025
bfe689e
refactor(app_config): Update AppConfigurationBloc to emit HtHttpExcep…
fulleni Jul 14, 2025
35bb9de
refactor(app_config): Update AppConfigurationPage to use HtHttpExcept…
fulleni Jul 14, 2025
d3a8c1e
refactor(settings): Refactor SettingsState to use HtHttpException
fulleni Jul 14, 2025
0362b09
refactor(settings): Update SettingsBloc to emit HtHttpException
fulleni Jul 14, 2025
1697e36
refactor(settings): Update SettingsPage to use HtHttpException and fr…
fulleni Jul 14, 2025
a38263a
docs: Add user-friendly error handling to features list
fulleni Jul 14, 2025
7e5a9f5
refactor(content_management): Replace errorMessage with exception
fulleni Jul 14, 2025
8d69bb3
refactor(content_management): replace errorMessage with exception
fulleni Jul 14, 2025
7d565eb
fix(create_topic): improve error handling
fulleni Jul 14, 2025
12ba1ad
refactor(content_management): replace errorMessage with exception
fulleni Jul 14, 2025
60654ef
refactor(content_management): replace errorMessage with exception
fulleni Jul 14, 2025
c2e2cb4
refactor(content_management): replace errorMessage with exception
fulleni Jul 14, 2025
4cca6a5
fix(content-management): improve error handling in blocs
fulleni Jul 14, 2025
dbb0566
fix(content_management): Improve error handling in EditSourceBloc
fulleni Jul 14, 2025
006d5b0
fix(createHeadlineBloc): Handle exceptions more robustly
fulleni Jul 14, 2025
89e12c4
fix(content_management): improve error handling in EditHeadlineBloc
fulleni Jul 14, 2025
876affb
fix(content_management): improve error handling
fulleni Jul 14, 2025
cf2142a
fix(content_management): improve error handling in create source page
fulleni Jul 14, 2025
37f75ed
fix(content_management): improve error handling in create topic page
fulleni Jul 14, 2025
e278f7b
fix(content_management): Improve error handling in EditSourcePage
fulleni Jul 14, 2025
92e0bf0
fix(content_management): improve error handling
fulleni Jul 14, 2025
53840cf
fix(createHeadlineBloc): improve error handling
fulleni Jul 14, 2025
f8e0d5f
feat(content_management): Add HTUIKit dependency
fulleni Jul 14, 2025
63b132d
feat(content_management): add ht_ui_kit dependency
fulleni Jul 14, 2025
769fcee
fix(content_management): Improve error handling in EditHeadlinePage
fulleni Jul 14, 2025
35fc611
refactor(content_management): replace errorMessage with exception
fulleni Jul 14, 2025
33e0e21
fix(content_management): display specific exception in failure state
fulleni Jul 14, 2025
1f99267
fix(content_management): Handle exceptions more robustly
fulleni Jul 14, 2025
c162cff
fix(content_management): display specific exception message
fulleni Jul 14, 2025
7d22ab1
fix(content_management): display exception details
fulleni Jul 14, 2025
a6e5c1e
style: format
fulleni Jul 14, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ Control the behavior and appearance of the `ht_main` mobile application remotely
#### 📊 **Intuitive User Interface**
Built with Flutter, the dashboard provides a responsive and user-friendly
experience across various web browsers and screen sizes.
* **User-Friendly Error Handling:** Displays clear, localized error messages for a smooth and understandable user experience when issues arise.
* **Benefit for you:** A modern, maintainable, and visually appealing
interface for your administrative tasks. ✨

Expand Down
1 change: 1 addition & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
analyzer:
errors:
avoid_bool_literals_in_conditional_expressions: ignore
avoid_catches_without_on_clauses: ignore
avoid_print: ignore
avoid_redundant_argument_values: ignore
Expand Down
35 changes: 20 additions & 15 deletions lib/app/view/app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import 'package:ht_dashboard/shared/theme/app_theme.dart';
import 'package:ht_data_repository/ht_data_repository.dart';
import 'package:ht_kv_storage_service/ht_kv_storage_service.dart';
import 'package:ht_shared/ht_shared.dart' hide AppStatus;
import 'package:ht_ui_kit/ht_ui_kit.dart';
import 'package:logging/logging.dart';

class App extends StatelessWidget {
Expand All @@ -29,7 +30,8 @@ class App extends StatelessWidget {
required HtDataRepository<Country> htCountriesRepository,
required HtDataRepository<Source> htSourcesRepository,
required HtDataRepository<UserAppSettings> htUserAppSettingsRepository,
required HtDataRepository<UserContentPreferences> htUserContentPreferencesRepository,
required HtDataRepository<UserContentPreferences>
htUserContentPreferencesRepository,
required HtDataRepository<RemoteConfig> htRemoteConfigRepository,
required HtDataRepository<DashboardSummary> htDashboardSummaryRepository,
required HtKVStorageService kvStorageService,
Expand All @@ -53,7 +55,8 @@ class App extends StatelessWidget {
final HtDataRepository<Country> _htCountriesRepository;
final HtDataRepository<Source> _htSourcesRepository;
final HtDataRepository<UserAppSettings> _htUserAppSettingsRepository;
final HtDataRepository<UserContentPreferences> _htUserContentPreferencesRepository;
final HtDataRepository<UserContentPreferences>
_htUserContentPreferencesRepository;
final HtDataRepository<RemoteConfig> _htRemoteConfigRepository;
final HtDataRepository<DashboardSummary> _htDashboardSummaryRepository;
final HtKVStorageService _kvStorageService;
Expand All @@ -79,10 +82,10 @@ class App extends StatelessWidget {
BlocProvider(
create: (context) => AppBloc(
authenticationRepository: context.read<HtAuthRepository>(),
userAppSettingsRepository:
context.read<HtDataRepository<UserAppSettings>>(),
appConfigRepository:
context.read<HtDataRepository<RemoteConfig>>(),
userAppSettingsRepository: context
.read<HtDataRepository<UserAppSettings>>(),
appConfigRepository: context
.read<HtDataRepository<RemoteConfig>>(),
environment: _environment,
logger: Logger('AppBloc'),
),
Expand All @@ -94,8 +97,8 @@ class App extends StatelessWidget {
),
BlocProvider(
create: (context) => AppConfigurationBloc(
remoteConfigRepository:
context.read<HtDataRepository<RemoteConfig>>(),
remoteConfigRepository: context
.read<HtDataRepository<RemoteConfig>>(),
),
),
BlocProvider(
Expand All @@ -107,10 +110,10 @@ class App extends StatelessWidget {
),
BlocProvider(
create: (context) => DashboardBloc(
dashboardSummaryRepository:
context.read<HtDataRepository<DashboardSummary>>(),
appConfigRepository:
context.read<HtDataRepository<RemoteConfig>>(),
dashboardSummaryRepository: context
.read<HtDataRepository<DashboardSummary>>(),
appConfigRepository: context
.read<HtDataRepository<RemoteConfig>>(),
headlinesRepository: context.read<HtDataRepository<Headline>>(),
),
),
Expand Down Expand Up @@ -209,9 +212,11 @@ class _AppViewState extends State<_AppView> {
child: MaterialApp.router(
debugShowCheckedModeBanner: false,
routerConfig: _router,
localizationsDelegates:
AppLocalizations.localizationsDelegates,
supportedLocales: AppLocalizations.supportedLocales,
localizationsDelegates: const [
HtUiKitLocalizations.delegate,
...AppLocalizations.localizationsDelegates,
],
supportedLocales: HtUiKitLocalizations.supportedLocales,
theme: baseTheme == AppBaseTheme.dark
? darkThemeData
: lightThemeData,
Expand Down
8 changes: 4 additions & 4 deletions lib/app_configuration/bloc/app_configuration_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ class AppConfigurationBloc
emit(
state.copyWith(
status: AppConfigurationStatus.failure,
errorMessage: e.message,
exception: e,
),
);
} catch (e) {
emit(
state.copyWith(
status: AppConfigurationStatus.failure,
errorMessage: 'An unknown error occurred: $e',
exception: UnknownException('An unknown error occurred: $e'),
),
);
}
Expand Down Expand Up @@ -79,14 +79,14 @@ class AppConfigurationBloc
emit(
state.copyWith(
status: AppConfigurationStatus.failure,
errorMessage: e.message,
exception: e,
),
);
} catch (e) {
emit(
state.copyWith(
status: AppConfigurationStatus.failure,
errorMessage: 'An unknown error occurred: $e',
exception: UnknownException('An unknown error occurred: $e'),
),
);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/app_configuration/bloc/app_configuration_event.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class AppConfigurationLoaded extends AppConfigurationEvent {
/// {@template app_configuration_updated}
/// Event to request the update of the application configuration.
///
/// Carries the new [appConfig] object to be saved.
/// Carries the new "appConfig" object to be saved.
/// {@endtemplate}
class AppConfigurationUpdated extends AppConfigurationEvent {
/// {@macro app_configuration_updated}
Expand Down
14 changes: 6 additions & 8 deletions lib/app_configuration/bloc/app_configuration_state.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class AppConfigurationState extends Equatable {
this.status = AppConfigurationStatus.initial,
this.remoteConfig,
this.originalRemoteConfig,
this.errorMessage,
this.exception,
this.isDirty = false,
this.showSaveSuccess = false,
});
Expand All @@ -38,8 +38,8 @@ class AppConfigurationState extends Equatable {
/// The original application configuration loaded from the backend.
final RemoteConfig? originalRemoteConfig;

/// An error message if an operation failed.
final String? errorMessage;
/// An error exception if an operation failed.
final HtHttpException? exception;

/// Indicates if there are unsaved changes to the configuration.
final bool isDirty;
Expand All @@ -52,7 +52,7 @@ class AppConfigurationState extends Equatable {
AppConfigurationStatus? status,
RemoteConfig? remoteConfig,
RemoteConfig? originalRemoteConfig,
String? errorMessage,
HtHttpException? exception,
bool? isDirty,
bool clearErrorMessage = false,
bool? showSaveSuccess,
Expand All @@ -62,9 +62,7 @@ class AppConfigurationState extends Equatable {
status: status ?? this.status,
remoteConfig: remoteConfig ?? this.remoteConfig,
originalRemoteConfig: originalRemoteConfig ?? this.originalRemoteConfig,
errorMessage: clearErrorMessage
? null
: errorMessage ?? this.errorMessage,
exception: clearErrorMessage ? null : exception ?? this.exception,
isDirty: isDirty ?? this.isDirty,
showSaveSuccess: clearShowSaveSuccess
? false
Expand All @@ -77,7 +75,7 @@ class AppConfigurationState extends Equatable {
status,
remoteConfig,
originalRemoteConfig,
errorMessage,
exception,
isDirty,
showSaveSuccess,
];
Expand Down
Loading
Loading