@@ -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.' ));
@@ -1046,6 +1024,39 @@ class UpdateMachine {
10461024    reportErrorToUserBriefly (null );
10471025  }
10481026
1027+   /// Sort out an error from the network request in [poll] . 
1028+   /// 
1029+   /// If the request should be retried, this method returns true, 
1030+   /// after reporting the error if appropriate to the user and/or developer. 
1031+   /// Otherwise, this method returns false with no side effects. 
1032+ bool  _triagePollRequestError (Object  error) {
1033+     bool  shouldReportToUser;
1034+     switch  (error) {
1035+       case  NetworkException (cause:  SocketException ()): 
1036+         // A [SocketException] is common when the app returns from sleep. 
1037+         shouldReportToUser =  false ;
1038+ 
1039+       case  NetworkException (): 
1040+       case  Server5xxException (): 
1041+         shouldReportToUser =  true ;
1042+ 
1043+       case  ZulipApiException (httpStatus:  429 ): 
1044+       case  ZulipApiException (code:  'RATE_LIMIT_HIT' ): 
1045+         // TODO(#946) handle rate-limit errors more generally, in ApiConnection 
1046+         shouldReportToUser =  true ;
1047+ 
1048+       default : 
1049+         return  false ;
1050+     }
1051+ 
1052+     assert (debugLog ('Transient error polling event queue for $store : $error \n ' 
1053+         'Backing off, then will retry…' ));
1054+     if  (shouldReportToUser) {
1055+       _maybeReportToUserTransientError (error);
1056+     }
1057+     return  true ;
1058+   }
1059+ 
10491060  /// Report an error in [poll] , if appropriate, to the user and/or developer. 
10501061void  _reportPollError (Object  error) {
10511062    switch  (error) {
0 commit comments