Skip to content

Commit dbb0566

Browse files
committed
fix(content_management): Improve error handling in EditSourceBloc
- Replaced errorMessage with exception property. - Improved error reporting for unexpected errors. - Handle cases where original source data is missing.
1 parent 4cca6a5 commit dbb0566

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

lib/content_management/bloc/edit_source/edit_source_bloc.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,14 @@ class EditSourceBloc extends Bloc<EditSourceEvent, EditSourceState> {
6464
emit(
6565
state.copyWith(
6666
status: EditSourceStatus.failure,
67-
errorMessage: e.message,
67+
exception: e,
6868
),
6969
);
7070
} catch (e) {
7171
emit(
7272
state.copyWith(
7373
status: EditSourceStatus.failure,
74-
errorMessage: e.toString(),
74+
exception: UnknownException('An unexpected error occurred: $e'),
7575
),
7676
);
7777
}
@@ -162,7 +162,7 @@ class EditSourceBloc extends Bloc<EditSourceEvent, EditSourceState> {
162162
emit(
163163
state.copyWith(
164164
status: EditSourceStatus.failure,
165-
errorMessage: 'Cannot update: Original source data not loaded.',
165+
exception: UnknownException('Cannot update: Original source data not loaded.'),
166166
),
167167
);
168168
return;
@@ -192,14 +192,14 @@ class EditSourceBloc extends Bloc<EditSourceEvent, EditSourceState> {
192192
emit(
193193
state.copyWith(
194194
status: EditSourceStatus.failure,
195-
errorMessage: e.message,
195+
exception: e,
196196
),
197197
);
198198
} catch (e) {
199199
emit(
200200
state.copyWith(
201201
status: EditSourceStatus.failure,
202-
errorMessage: e.toString(),
202+
exception: UnknownException('An unexpected error occurred: $e'),
203203
),
204204
);
205205
}

0 commit comments

Comments
 (0)