File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 5959 InvalidOperation ,
6060 NotPrimaryError ,
6161 OperationFailure ,
62+ PyMongoError ,
6263 WaitQueueTimeoutError ,
6364)
6465from pymongo .helpers_shared import _RETRYABLE_ERROR_CODES
@@ -563,13 +564,9 @@ async def _execute_command(
563564 error , ConnectionFailure
564565 ) and not isinstance (error , (NotPrimaryError , WaitQueueTimeoutError ))
565566
566- retryable_label_error = (
567- hasattr (error , "details" )
568- and isinstance (error .details , dict )
569- and "errorLabels" in error .details
570- and isinstance (error .details ["errorLabels" ], list )
571- and "RetryableError" in error .details ["errorLabels" ]
572- )
567+ retryable_label_error = isinstance (
568+ error , PyMongoError
569+ ) and error .has_error_label ("RetryableError" )
573570
574571 # Synthesize the full bulk result without modifying the
575572 # current one because this write operation may be retried.
Original file line number Diff line number Diff line change 5959 InvalidOperation ,
6060 NotPrimaryError ,
6161 OperationFailure ,
62+ PyMongoError ,
6263 WaitQueueTimeoutError ,
6364)
6465from pymongo .helpers_shared import _RETRYABLE_ERROR_CODES
@@ -561,13 +562,9 @@ def _execute_command(
561562 error , ConnectionFailure
562563 ) and not isinstance (error , (NotPrimaryError , WaitQueueTimeoutError ))
563564
564- retryable_label_error = (
565- hasattr (error , "details" )
566- and isinstance (error .details , dict )
567- and "errorLabels" in error .details
568- and isinstance (error .details ["errorLabels" ], list )
569- and "RetryableError" in error .details ["errorLabels" ]
570- )
565+ retryable_label_error = isinstance (
566+ error , PyMongoError
567+ ) and error .has_error_label ("RetryableError" )
571568
572569 # Synthesize the full bulk result without modifying the
573570 # current one because this write operation may be retried.
You can’t perform that action at this time.
0 commit comments