MCPcopy
hub / github.com/anthropics/anthropic-sdk-python / __init__

Method __init__

src/anthropic/_exceptions.py:73–83  ·  view source on GitHub ↗
(self, message: str, *, response: httpx.Response, body: object | None)

Source from the content-addressed store, hash-verified

71 type: ErrorType | None
72
73 def __init__(self, message: str, *, response: httpx.Response, body: object | None) -> None:
74 super().__init__(message, response.request, body=body)
75 self.response = response
76 self.status_code = response.status_code
77 self.request_id = response.headers.get("request-id")
78
79 self.type = None
80 if is_dict(body):
81 error = body.get("error")
82 if is_dict(error):
83 self.type = cast(Union[ErrorType, None], error.get("type"))
84
85
86class APIConnectionError(APIError):

Callers

nothing calls this directly

Calls 3

is_dictFunction · 0.85
__init__Method · 0.45
getMethod · 0.45

Tested by

no test coverage detected