Skip to content

Commit 89e12c4

Browse files
committed
fix(content_management): improve error handling in EditHeadlineBloc
- Replaced errorMessage with exception in state - Improved error wrapping for better context - Handle unexpected errors more gracefully
1 parent 006d5b0 commit 89e12c4

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

lib/content_management/bloc/edit_headline/edit_headline_bloc.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,14 @@ class EditHeadlineBloc extends Bloc<EditHeadlineEvent, EditHeadlineState> {
8484
emit(
8585
state.copyWith(
8686
status: EditHeadlineStatus.failure,
87-
errorMessage: e.message,
87+
exception: e,
8888
),
8989
);
9090
} catch (e) {
9191
emit(
9292
state.copyWith(
9393
status: EditHeadlineStatus.failure,
94-
errorMessage: e.toString(),
94+
exception: UnknownException('An unexpected error occurred: $e'),
9595
),
9696
);
9797
}
@@ -196,7 +196,7 @@ class EditHeadlineBloc extends Bloc<EditHeadlineEvent, EditHeadlineState> {
196196
emit(
197197
state.copyWith(
198198
status: EditHeadlineStatus.failure,
199-
errorMessage: 'Cannot update: Original headline data not loaded.',
199+
exception: UnknownException('Cannot update: Original headline data not loaded.'),
200200
),
201201
);
202202
return;
@@ -227,14 +227,14 @@ class EditHeadlineBloc extends Bloc<EditHeadlineEvent, EditHeadlineState> {
227227
emit(
228228
state.copyWith(
229229
status: EditHeadlineStatus.failure,
230-
errorMessage: e.message,
230+
exception: e,
231231
),
232232
);
233233
} catch (e) {
234234
emit(
235235
state.copyWith(
236236
status: EditHeadlineStatus.failure,
237-
errorMessage: e.toString(),
237+
exception: UnknownException('An unexpected error occurred: $e'),
238238
),
239239
);
240240
}

0 commit comments

Comments
 (0)