The server responded "not primary" or "node is recovering". These errors result from a query, write, or command. The operation failed because the client thought it was using the primary but the primary has stepped down, or the client thought it was using a healthy secondary but the
| 131 | |
| 132 | |
| 133 | class NotPrimaryError(AutoReconnect): |
| 134 | """The server responded "not primary" or "node is recovering". |
| 135 | |
| 136 | These errors result from a query, write, or command. The operation failed |
| 137 | because the client thought it was using the primary but the primary has |
| 138 | stepped down, or the client thought it was using a healthy secondary but |
| 139 | the secondary is stale and trying to recover. |
| 140 | |
| 141 | The client launches a refresh operation on a background thread, to update |
| 142 | its view of the server as soon as possible after throwing this exception. |
| 143 | |
| 144 | Subclass of :exc:`~pymongo.errors.AutoReconnect`. |
| 145 | |
| 146 | .. versionadded:: 3.12 |
| 147 | """ |
| 148 | |
| 149 | def __init__( |
| 150 | self, message: str = "", errors: Optional[Union[Mapping[str, Any], list[Any]]] = None |
| 151 | ) -> None: |
| 152 | super().__init__(_format_detailed_error(message, errors), errors=errors) |
| 153 | |
| 154 | |
| 155 | class ServerSelectionTimeoutError(AutoReconnect): |
no outgoing calls