Return True if given a resumable change stream error.
(exc: PyMongoError)
| 75 | |
| 76 | |
| 77 | def _resumable(exc: PyMongoError) -> bool: |
| 78 | """Return True if given a resumable change stream error.""" |
| 79 | if isinstance(exc, (ConnectionFailure, CursorNotFound)): |
| 80 | return True |
| 81 | if isinstance(exc, OperationFailure): |
| 82 | if exc._max_wire_version is None: |
| 83 | return False |
| 84 | return ( |
| 85 | exc._max_wire_version >= 9 and exc.has_error_label("ResumableChangeStreamError") |
| 86 | ) or (exc._max_wire_version < 9 and exc.code in _RESUMABLE_GETMORE_ERRORS) |
| 87 | return False |
| 88 | |
| 89 | |
| 90 | class ChangeStream(Generic[_DocumentType]): |
no test coverage detected