Skip to content
Myr

Add `request` getter/setter to `HTTPError` (#2158)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Michael Oliver · committed by GitHub · parent 3350d7e · Browse files · 1 file+11 added−10 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+11 added−10 removed

  • other:+11 added−10 removed

1 file+11 added−10 removed

modified:httpx/_exceptions.py+11 added-10 removed
56 unmodified lines
57 """5859 def __init__(self, message: str) -> None:60 super().__init__(message)61 self._request: typing.Optional["Request"] = None6263 @property64 def request(self) -> "Request":65 if self._request is None:66 raise RuntimeError("The .request property has not been set.")67 return self._request6869 @request.setter70 def request(self, request: "Request") -> None:71 self._request = request727374class RequestError(HTTPError):75 """76 Base class for all exceptions that may occur when issuing a `.request()`.77 """
7 unmodified lines
85 # Response methods in order to ensure that any raised exceptions86 # have a `.request` property set on them.87 self._request = request8878 @property79 def request(self) -> "Request":80 if self._request is None:81 raise RuntimeError("The .request property has not been set.")82 return self._request8984 @request.setter85 def request(self, request: "Request") -> None:86 self._request = request878890class TransportError(RequestError):91 """92 Base class for all exceptions that occur at the level of the Transport API.93 """
247 unmodified lines