exceptions
Class info¶
Classes¶
| Name | Children | Inherits |
|---|---|---|
| InvalidResponseError aclientp.exceptions The peer answered a request with a result that does not match the method's schema. |
||
| ProtocolVersionError aclientp.exceptions The peer answered ``initialize`` with a protocol version this side does not speak. |
||
| RequestError aclientp.exceptions Raised when a JSON-RPC request fails. |
🛈 DocStrings¶
ACP-related exceptions.
InvalidResponseError
¶
Bases: RequestError
The peer answered a request with a result that does not match the method's schema.
Raised by the typed v2 calls instead of a bare pydantic.ValidationError, which
is kept as __cause__. Code -32603 (Internal error); data holds the
method and the validation errors.
Source code in src/aclientp/exceptions.py
errors
instance-attribute
¶
The validation errors (pydantic's errors(), without URLs and contexts).
from_validation_error
classmethod
¶
from_validation_error(method: str, exc: ValidationError) -> InvalidResponseError
Build the error from a pydantic validation error.
ProtocolVersionError
¶
Bases: RequestError
The peer answered initialize with a protocol version this side does not speak.
Raised by clients before the rest of the response is validated, so an agent that only speaks another version (e.g. a v1 agent answering a v2 client) is reported as such instead of as a malformed response.
Source code in src/aclientp/exceptions.py
RequestError
¶
Bases: Exception
Raised when a JSON-RPC request fails.
Source code in src/aclientp/exceptions.py
from_error_obj
classmethod
¶
Build an error from a peer's JSON-RPC error object.
Peers are not trusted to send a well-formed object: data is optional per
JSON-RPC 2.0 and code / message may be missing or have the wrong type.
Source code in src/aclientp/exceptions.py
session_not_found
classmethod
¶
-32002 for a request naming a session that does not exist or is not active.
unsupported_protocol_version
classmethod
¶
-32022: no supported protocol version is at or below the requested one.