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

Method _handle_connection_error

pymongo/synchronous/pool.py:990–1003  ·  view source on GitHub ↗
(self, error: BaseException)

Source from the content-addressed store, hash-verified

988 self.size_cond.notify()
989
990 def _handle_connection_error(self, error: BaseException) -> None:
991 # Handle system overload condition for non-sdam pools.
992 # Look for errors of type AutoReconnect and add error labels if appropriate.
993 if self.is_sdam or type(error) not in (AutoReconnect, NetworkTimeout):
994 return
995 assert isinstance(error, AutoReconnect) # Appease type checker.
996 # If the original error was a DNS, certificate, or SSL error, ignore it.
997 if isinstance(error.__cause__, (_CertificateError, SSLErrors, socket.gaierror)):
998 # End of file errors are excluded, because the server may have disconnected
999 # during the handshake.
1000 if not isinstance(error.__cause__, (ssl.SSLEOFError, ssl.SSLZeroReturnError)):
1001 return
1002 error._add_error_label("SystemOverloadedError")
1003 error._add_error_label("RetryableError")
1004
1005 def connect(self, handler: Optional[_MongoClientErrorHandler] = None) -> Connection:
1006 """Connect to Mongo and return a new Connection.

Callers 1

connectMethod · 0.95

Calls 1

_add_error_labelMethod · 0.80

Tested by

no test coverage detected