Home / Class/ APIError Class — anthropic-sdk-python Architecture

APIError Class — anthropic-sdk-python Architecture

Architecture documentation for the APIError class in _exceptions.py from the anthropic-sdk-python codebase.

Entity Profile

Dependency Diagram

graph TD
  8072012e_af1e_a492_c4c9_62780dfef308["APIError"]
  145ee5ba_422d_688e_ca30_dbf4a26bf47f["AnthropicError"]
  8072012e_af1e_a492_c4c9_62780dfef308 -->|extends| 145ee5ba_422d_688e_ca30_dbf4a26bf47f
  b3e43638_c882_dccb_b00e_ddc6b5147130["_exceptions.py"]
  8072012e_af1e_a492_c4c9_62780dfef308 -->|defined in| b3e43638_c882_dccb_b00e_ddc6b5147130
  99b8c097_9498_3d44_f1c6_52ecbc18264f["__init__()"]
  8072012e_af1e_a492_c4c9_62780dfef308 -->|method| 99b8c097_9498_3d44_f1c6_52ecbc18264f

Relationship Graph

Source Code

src/anthropic/_exceptions.py lines 25–44

class APIError(AnthropicError):
    message: str
    request: httpx.Request

    body: object | None
    """The API response body.

    If the API responded with a valid JSON structure then this property will be the
    decoded result.

    If it isn't a valid JSON structure then this will be the raw response.

    If there was no response associated with this error then it will be `None`.
    """

    def __init__(self, message: str, request: httpx.Request, *, body: object | None) -> None:  # noqa: ARG002
        super().__init__(message)
        self.request = request
        self.message = message
        self.body = body

Extends

Frequently Asked Questions

What is the APIError class?
APIError is a class in the anthropic-sdk-python codebase, defined in src/anthropic/_exceptions.py.
Where is APIError defined?
APIError is defined in src/anthropic/_exceptions.py at line 25.
What does APIError extend?
APIError extends AnthropicError.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free