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