File tree Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -954,6 +954,7 @@ class UpdateMachine {
954
954
}
955
955
956
956
Completer <void >? _debugLoopSignal;
957
+ Object ? _debugLoopError;
957
958
958
959
/// In debug mode, causes the polling loop to pause before the next
959
960
/// request and wait for [debugAdvanceLoop] to be called.
@@ -965,11 +966,29 @@ class UpdateMachine {
965
966
}());
966
967
}
967
968
969
+ /// In debug mode, causes the next [debugAdvanceLoop] call to induce
970
+ /// the given error to be thrown from the polling loop.
971
+ void debugPrepareLoopError (Object error) {
972
+ assert (() {
973
+ assert (_debugLoopError == null );
974
+ _debugLoopError = error;
975
+ return true ;
976
+ }());
977
+ }
978
+
968
979
/// In debug mode, after a call to [debugPauseLoop] , causes the
969
980
/// polling loop to make one more request and then pause again.
981
+ ///
982
+ /// If [debugPrepareLoopError] was called since the last [debugAdvanceLoop]
983
+ /// or [debugPauseLoop] , the polling loop will throw the prepared error
984
+ /// instead of making a request.
970
985
void debugAdvanceLoop () {
971
986
assert ((){
972
- _debugLoopSignal! .complete ();
987
+ if (_debugLoopError != null ) {
988
+ _debugLoopSignal! .completeError (_debugLoopError! );
989
+ } else {
990
+ _debugLoopSignal! .complete ();
991
+ }
973
992
return true ;
974
993
}());
975
994
}
You can’t perform that action at this time.
0 commit comments