MCPcopy Create free account
hub / github.com/mongodb/mongo-python-driver / _resumable

Function _resumable

pymongo/synchronous/change_stream.py:77–87  ·  view source on GitHub ↗

Return True if given a resumable change stream error.

(exc: PyMongoError)

Source from the content-addressed store, hash-verified

75
76
77def _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
90class ChangeStream(Generic[_DocumentType]):

Callers 1

try_nextMethod · 0.70

Calls 1

has_error_labelMethod · 0.80

Tested by

no test coverage detected