A non-2xx HTTP response from the wigolo REST API. ``error``/``error_reason``/``stage`` come from the server's error envelope when present. ``retry_after`` is parsed from the ``Retry-After`` header (seconds) when the server sends one — set on 429 responses. ``raw_body`` is the decode
| 17 | |
| 18 | |
| 19 | class WigoloAPIError(WigoloError): |
| 20 | """A non-2xx HTTP response from the wigolo REST API. |
| 21 | |
| 22 | ``error``/``error_reason``/``stage`` come from the server's error |
| 23 | envelope when present. ``retry_after`` is parsed from the |
| 24 | ``Retry-After`` header (seconds) when the server sends one — set on |
| 25 | 429 responses. ``raw_body`` is the decoded response body (used to |
| 26 | recover the report from a contract-defined 503-with-body ``/health``). |
| 27 | """ |
| 28 | |
| 29 | def __init__( |
| 30 | self, |
| 31 | message: str, |
| 32 | *, |
| 33 | status: int, |
| 34 | error: Optional[str] = None, |
| 35 | error_reason: Optional[str] = None, |
| 36 | stage: Optional[str] = None, |
| 37 | retry_after: Optional[int] = None, |
| 38 | raw_body: Optional[str] = None, |
| 39 | ) -> None: |
| 40 | super().__init__(message) |
| 41 | self.status = status |
| 42 | self.error = error |
| 43 | self.error_reason = error_reason |
| 44 | self.stage = stage |
| 45 | self.retry_after = retry_after |
| 46 | self.raw_body = raw_body |
| 47 | |
| 48 | |
| 49 | class WigoloConnectionError(WigoloError): |
no outgoing calls