@@ -949,30 +949,8 @@ class UpdateMachine {
949949          if  (_disposed) return ;
950950
951951          store.isLoading =  true ;
952-           bool  shouldReportToUser;
953-           switch  (e) {
954-             case  NetworkException (cause:  SocketException ()): 
955-               // A [SocketException] is common when the app returns from sleep. 
956-               shouldReportToUser =  false ;
957- 
958-             case  NetworkException (): 
959-             case  Server5xxException (): 
960-               shouldReportToUser =  true ;
961- 
962-             case  ZulipApiException (httpStatus:  429 ): 
963-             case  ZulipApiException (code:  'RATE_LIMIT_HIT' ): 
964-               // TODO(#946) handle rate-limit errors more generally, in ApiConnection 
965-               shouldReportToUser =  true ;
966- 
967-             default : 
968-               rethrow ;
969-           }
970- 
971-           assert (debugLog ('Transient error polling event queue for $store : $e \n ' 
972-               'Backing off, then will retry…' ));
973-           if  (shouldReportToUser) {
974-             _maybeReportToUserTransientError (e);
975-           }
952+           final  shouldRetry =  _triagePollRequestError (e);
953+           if  (! shouldRetry) rethrow ;
976954          await  (backoffMachine ?? =  BackoffMachine ()).wait ();
977955          if  (_disposed) return ;
978956          assert (debugLog ('… Backoff wait complete, retrying poll.' ));
@@ -1047,6 +1025,39 @@ class UpdateMachine {
10471025    reportErrorToUserBriefly (null );
10481026  }
10491027
1028+   /// Sort out an error from the network request in [poll] . 
1029+   /// 
1030+   /// If the request should be retried, this method returns true, 
1031+   /// after reporting the error if appropriate to the user and/or developer. 
1032+   /// Otherwise, this method returns false with no side effects. 
1033+ bool  _triagePollRequestError (Object  error) {
1034+     bool  shouldReportToUser;
1035+     switch  (error) {
1036+       case  NetworkException (cause:  SocketException ()): 
1037+         // A [SocketException] is common when the app returns from sleep. 
1038+         shouldReportToUser =  false ;
1039+ 
1040+       case  NetworkException (): 
1041+       case  Server5xxException (): 
1042+         shouldReportToUser =  true ;
1043+ 
1044+       case  ZulipApiException (httpStatus:  429 ): 
1045+       case  ZulipApiException (code:  'RATE_LIMIT_HIT' ): 
1046+         // TODO(#946) handle rate-limit errors more generally, in ApiConnection 
1047+         shouldReportToUser =  true ;
1048+ 
1049+       default : 
1050+         return  false ;
1051+     }
1052+ 
1053+     assert (debugLog ('Transient error polling event queue for $store : $error \n ' 
1054+         'Backing off, then will retry…' ));
1055+     if  (shouldReportToUser) {
1056+       _maybeReportToUserTransientError (error);
1057+     }
1058+     return  true ;
1059+   }
1060+ 
10501061  /// Report an error in [poll] , if appropriate, to the user and/or developer. 
10511062void  _reportPollError (Object  error) {
10521063    switch  (error) {
0 commit comments