_make_status_error_from_response() — anthropic-sdk-python Function Reference
Architecture documentation for the _make_status_error_from_response() function in _base_client.py from the anthropic-sdk-python codebase.
Entity Profile
Dependency Diagram
graph TD 9ebcd2d0_98f2_9b15_5411_1ffe59265a58["_make_status_error_from_response()"] f4bdbf63_c583_8b55_7bae_4e29fc6511ad["BaseClient"] 9ebcd2d0_98f2_9b15_5411_1ffe59265a58 -->|defined in| f4bdbf63_c583_8b55_7bae_4e29fc6511ad 8b2eb164_9820_c380_9c04_55e207e6fb57["request()"] 8b2eb164_9820_c380_9c04_55e207e6fb57 -->|calls| 9ebcd2d0_98f2_9b15_5411_1ffe59265a58 46a9cb10_9164_0414_593f_6eb07b4ef5de["request()"] 46a9cb10_9164_0414_593f_6eb07b4ef5de -->|calls| 9ebcd2d0_98f2_9b15_5411_1ffe59265a58 6619d064_27f4_ae06_0dd6_509381151d41["_make_status_error()"] 9ebcd2d0_98f2_9b15_5411_1ffe59265a58 -->|calls| 6619d064_27f4_ae06_0dd6_509381151d41 style 9ebcd2d0_98f2_9b15_5411_1ffe59265a58 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
src/anthropic/_base_client.py lines 409–429
def _make_status_error_from_response(
self,
response: httpx.Response,
) -> APIStatusError:
if response.is_closed and not response.is_stream_consumed:
# We can't read the response body as it has been closed
# before it was read. This can happen if an event hook
# raises a status error.
body = None
err_msg = f"Error code: {response.status_code}"
else:
err_text = response.text.strip()
body = err_text
try:
body = json.loads(err_text)
err_msg = f"Error code: {response.status_code} - {body}"
except Exception:
err_msg = err_text or f"Error code: {response.status_code}"
return self._make_status_error(err_msg, body=body, response=response)
Domain
Subdomains
Defined In
Calls
Source
Frequently Asked Questions
What does _make_status_error_from_response() do?
_make_status_error_from_response() is a function in the anthropic-sdk-python codebase, defined in src/anthropic/_base_client.py.
Where is _make_status_error_from_response() defined?
_make_status_error_from_response() is defined in src/anthropic/_base_client.py at line 409.
What does _make_status_error_from_response() call?
_make_status_error_from_response() calls 1 function(s): _make_status_error.
What calls _make_status_error_from_response()?
_make_status_error_from_response() is called by 2 function(s): request, request.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free