MCPcopy Index your code
hub / github.com/mongodb/mongo-python-driver / AutoReconnect

Class AutoReconnect

pymongo/errors.py:84–108  ·  view source on GitHub ↗

Raised when a connection to the database is lost and an attempt to auto-reconnect will be made. In order to auto-reconnect you must handle this exception, recognizing that the operation which caused it has not necessarily succeeded. Future operations will attempt to open a new conne

Source from the content-addressed store, hash-verified

82
83
84class AutoReconnect(ConnectionFailure):
85 """Raised when a connection to the database is lost and an attempt to
86 auto-reconnect will be made.
87
88 In order to auto-reconnect you must handle this exception, recognizing that
89 the operation which caused it has not necessarily succeeded. Future
90 operations will attempt to open a new connection to the database (and
91 will continue to raise this exception until the first successful
92 connection is made).
93
94 Subclass of :exc:`~pymongo.errors.ConnectionFailure`.
95 """
96
97 errors: Union[Mapping[str, Any], Sequence[Any]]
98 details: Union[Mapping[str, Any], Sequence[Any]]
99
100 def __init__(
101 self, message: str = "", errors: Optional[Union[Mapping[str, Any], Sequence[Any]]] = None
102 ) -> None:
103 error_labels = None
104 if errors is not None:
105 if isinstance(errors, dict):
106 error_labels = errors.get("errorLabels")
107 super().__init__(message, error_labels)
108 self.errors = self.details = errors or []
109
110
111class NetworkTimeout(AutoReconnect):

Callers 15

_runMethod · 0.90
got_app_errorFunction · 0.90
mock_commandMethod · 0.90
_check_with_socketMethod · 0.90
test_handle_errorMethod · 0.90
_check_with_socketMethod · 0.90
checkoutMethod · 0.90
mock_helloMethod · 0.90
_runMethod · 0.90
got_app_errorFunction · 0.90
mock_commandMethod · 0.90

Calls

no outgoing calls

Tested by 10

_runMethod · 0.72
got_app_errorFunction · 0.72
mock_commandMethod · 0.72
_check_with_socketMethod · 0.72
test_handle_errorMethod · 0.72
_check_with_socketMethod · 0.72
_runMethod · 0.72
got_app_errorFunction · 0.72
mock_commandMethod · 0.72