Class A2AError
- All Implemented Interfaces:
Event,Serializable
- Direct Known Subclasses:
A2AProtocolError,InternalError,InvalidParamsError,InvalidRequestError,JSONParseError,MethodNotFoundError
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 data.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)data- additional error information, structure defined by the error code (optional)- 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
-
getData
Gets additional information about the error.The structure and type of the data field is defined by the specific error code. It may contain detailed debugging information, validation errors, or other context-specific data to help diagnose the error.
- Returns:
- the error data, or null if not provided
-