You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
If an error/exception is thrown within onTransition, the bloc stops working completely: bloc.add stops adding events or mapEventToState doesn't receive them.
To Reproduce
@override
void onTransition(transition) {
throw new Exception('Explooooosion');
}
The bloc remains broken even if you comment out the exception, and hot reload.
The reason seems to stem from:
transformStates(transformEvents(_eventSubject, (Event event) {
currentEvent = event;
return mapEventToState(currentEvent).handleError(_handleError);
})).forEach(
(State nextState) {
if (state == nextState || _stateSubject.isClosed) return;
final transition = Transition(
currentState: state,
event: currentEvent,
nextState: nextState,
);
BlocSupervisor.delegate.onTransition(this, transition);
onTransition(transition); // <-- Will cause processing to stop.
_stateSubject.add(nextState);
},
);
.forEach states:
If this stream emits an error, or if the call to [action] throws, the returned future completes with that error, and processing stops.
The workaround for now is simply to try catch code running in onTransition.
The text was updated successfully, but these errors were encountered:
Describe the bug
If an error/exception is thrown within
onTransition
, the bloc stops working completely:bloc.add
stops adding events ormapEventToState
doesn't receive them.To Reproduce
The bloc remains broken even if you comment out the exception, and hot reload.
The reason seems to stem from:
.forEach
states:If this stream emits an error, or if the call to [action] throws, the returned future completes with that error, and processing stops.
The workaround for now is simply to try catch code running in
onTransition
.The text was updated successfully, but these errors were encountered: