Raised when we fail to establish a new connection. Usually ECONNREFUSED.
| 140 | |
| 141 | |
| 142 | class NewConnectionError(ConnectTimeoutError, HTTPError): |
| 143 | """Raised when we fail to establish a new connection. Usually ECONNREFUSED.""" |
| 144 | |
| 145 | def __init__(self, conn: HTTPConnection, message: str) -> None: |
| 146 | self.conn = conn |
| 147 | self._message = message |
| 148 | super().__init__(f"{conn}: {message}") |
| 149 | |
| 150 | def __reduce__(self) -> _TYPE_REDUCE_RESULT: |
| 151 | # For pickling purposes. |
| 152 | return self.__class__, (None, self._message) |
| 153 | |
| 154 | @property |
| 155 | def pool(self) -> HTTPConnection: |
| 156 | warnings.warn( |
| 157 | "The 'pool' property is deprecated and will be removed " |
| 158 | "in urllib3 v3.0. Use 'conn' instead.", |
| 159 | FutureWarning, |
| 160 | stacklevel=2, |
| 161 | ) |
| 162 | |
| 163 | return self.conn |
| 164 | |
| 165 | |
| 166 | class NameResolutionError(NewConnectionError): |
no outgoing calls