Raised when the Instant API returns a non-2xx response.
| 6 | |
| 7 | |
| 8 | class InstantAPIError(InstantError): |
| 9 | """Raised when the Instant API returns a non-2xx response.""" |
| 10 | |
| 11 | status: int |
| 12 | body: Any |
| 13 | hint: Any |
| 14 | trace_id: str | None |
| 15 | |
| 16 | def __init__(self, message: str, *, status: int, body: Any = None) -> None: |
| 17 | super().__init__(message) |
| 18 | self.status = status |
| 19 | self.body = body |
| 20 | # Surface hint/trace_id as attributes (like JS), not just inside body. |
| 21 | self.hint = body.get("hint") if isinstance(body, dict) else None |
| 22 | self.trace_id = ( |
| 23 | body.get("traceId") or body.get("trace-id") if isinstance(body, dict) else None |
| 24 | ) |
no outgoing calls
no test coverage detected