Package org.a2aproject.sdk.spec
Class InvalidRequestError
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
org.a2aproject.sdk.spec.A2AError
org.a2aproject.sdk.spec.InvalidRequestError
- All Implemented Interfaces:
Serializable,Event
JSON-RPC error indicating that the request payload is not a valid JSON-RPC Request object.
This error is returned when the JSON-RPC request fails structural validation. Common causes include:
- Missing required JSON-RPC fields (jsonrpc, method, id)
- Invalid JSON-RPC version (must be "2.0")
- Malformed request structure
- Type mismatches in required fields
Corresponds to JSON-RPC 2.0 error code -32600.
Usage example:
// Default error with standard message
throw new InvalidRequestError();
// Custom error message
throw new InvalidRequestError("Missing 'method' field in request");
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs an invalid request error with default message.InvalidRequestError(@Nullable Integer code, @Nullable String message, @Nullable Map<String, Object> details) Constructs an invalid request error with full parameters.InvalidRequestError(String message) Constructs an invalid request error with a message. -
Method Summary
Methods inherited from class org.a2aproject.sdk.spec.A2AError
getCode, getDetailsMethods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
InvalidRequestError
public InvalidRequestError()Constructs an invalid request error with default message. -
InvalidRequestError
public InvalidRequestError(@Nullable Integer code, @Nullable String message, @Nullable Map<String, Object> details) Constructs an invalid request error with full parameters.- Parameters:
code- the error codemessage- the error messagedetails- additional error details
-
InvalidRequestError
Constructs an invalid request error with a message.- Parameters:
message- the error message
-