@@ -280,7 +280,7 @@ def _parse_response_metadata_blob(blob: bytes) -> Tuple[str, str] | None:
280280 # failed to parse metadata
281281 return None
282282
283- def end_attempt_with_status (self , status : StatusCode | Exception ) -> None :
283+ def end_attempt_with_status (self , status : StatusCode | BaseException ) -> None :
284284 """
285285 Called to mark the end of an attempt for the operation.
286286
@@ -297,7 +297,7 @@ def end_attempt_with_status(self, status: StatusCode | Exception) -> None:
297297 return self ._handle_error (
298298 INVALID_STATE_ERROR .format ("end_attempt_with_status" , self .state )
299299 )
300- if isinstance (status , Exception ):
300+ if isinstance (status , BaseException ):
301301 status = self ._exc_to_status (status )
302302 complete_attempt = CompletedAttemptMetric (
303303 duration_ns = time .monotonic_ns () - self .active_attempt .start_time_ns ,
@@ -312,7 +312,7 @@ def end_attempt_with_status(self, status: StatusCode | Exception) -> None:
312312 for handler in self .handlers :
313313 handler .on_attempt_complete (complete_attempt , self )
314314
315- def end_with_status (self , status : StatusCode | Exception ) -> None :
315+ def end_with_status (self , status : StatusCode | BaseException ) -> None :
316316 """
317317 Called to mark the end of the operation. If there is an active attempt,
318318 end_attempt_with_status will be called with the same status.
@@ -329,7 +329,7 @@ def end_with_status(self, status: StatusCode | Exception) -> None:
329329 INVALID_STATE_ERROR .format ("end_with_status" , self .state )
330330 )
331331 final_status = (
332- self ._exc_to_status (status ) if isinstance (status , Exception ) else status
332+ self ._exc_to_status (status ) if isinstance (status , BaseException ) else status
333333 )
334334 if self .state == OperationState .ACTIVE_ATTEMPT :
335335 self .end_attempt_with_status (final_status )
@@ -367,7 +367,7 @@ def cancel(self):
367367 handler .on_operation_cancelled (self )
368368
369369 @staticmethod
370- def _exc_to_status (exc : Exception ) -> StatusCode :
370+ def _exc_to_status (exc : BaseException ) -> StatusCode :
371371 """
372372 Extracts the grpc status code from an exception.
373373
0 commit comments