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
| 82 | |
| 83 | |
| 84 | class 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 | |
| 111 | class NetworkTimeout(AutoReconnect): |
no outgoing calls