Package org.a2aproject.sdk.spec
Class A2AError
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
org.a2aproject.sdk.spec.A2AError
- All Implemented Interfaces:
Serializable,Event
- Direct Known Subclasses:
A2AProtocolError,InternalError,InvalidParamsError,InvalidRequestError,JSONParseError,MethodNotFoundError
Marker interface for A2A Protocol error events.
This interface extends Event to allow errors to be transmitted as events
in the A2A Protocol's event stream. All protocol-level errors implement this interface,
enabling uniform error handling across both streaming and non-streaming communication.
A2A errors typically extend A2AError to provide JSON-RPC 2.0 compliant
error responses with standard error codes, messages, and optional additional data.
Common implementations include:
InvalidParamsError- Invalid method parametersInvalidRequestError- Malformed requestMethodNotFoundError- Unknown methodInternalError- Server-side errorTaskNotFoundError- Task does not exist- And others for specific protocol error conditions
-
Constructor Summary
Constructors -
Method Summary
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
A2AError
Constructs a JSON-RPC error with the specified code, message, and optional details.This constructor is used by Jackson for JSON deserialization.
- Parameters:
code- the numeric error code (required, see JSON-RPC 2.0 spec for standard codes)message- the human-readable error message (required)details- additional error details as key-value pairs (defaults to empty map if null)- Throws:
IllegalArgumentException- if code or message is null
-
-
Method Details
-
getCode
Gets the numeric error code indicating the error type.Standard JSON-RPC 2.0 error codes:
- -32700: Parse error
- -32600: Invalid Request
- -32601: Method not found
- -32602: Invalid params
- -32603: Internal error
- -32000 to -32099: Server error (implementation-defined)
- Returns:
- the error code
-
getDetails
Gets additional details about the error as key-value pairs.- Returns:
- the error details, never null (empty map if no details provided)
-