(self, message: str, *, response: httpx2.Response, body: object | None)
| 123 | """ |
| 124 | |
| 125 | def __init__(self, message: str, *, response: httpx2.Response, body: object | None) -> None: |
| 126 | # imported here so that modules in `types` can import this one |
| 127 | from .types.shared.error_details import ErrorDetails |
| 128 | |
| 129 | super().__init__(message, response.request, body=body) |
| 130 | self.response = response |
| 131 | self.status_code = response.status_code |
| 132 | self.request_id = response.headers.get("request-id") |
| 133 | self.workspace_id = response.headers.get("anthropic-workspace-id") |
| 134 | self.api_message = extract_property(body, "error", "message") |
| 135 | self.type = extract_property(body, "error", "type") |
| 136 | self.error_code = extract_error_code(body) |
| 137 | self.details = construct_type_or_none( |
| 138 | value=extract_property(body, "error", "details"), type_=cast(Any, ErrorDetails) |
| 139 | ) |
| 140 | |
| 141 | |
| 142 | class APIConnectionError(APIError): |
nothing calls this directly
no test coverage detected