JSON-RPC 2.0 error with A2A-specific error codes.
Provides a struct and named constructors for the 14 error codes defined by the A2A protocol (5 standard JSON-RPC + 9 A2A-specific).
A2A-specific errors (-32001..-32009) serialize with a google.rpc.ErrorInfo
object inside a "data" array, as the spec requires. The 5 standard JSON-RPC
codes have no defined reason and keep their free-form data.
Example
iex> error = A2A.JSONRPC.Error.task_not_found()
iex> error.code
-32001
iex> A2A.JSONRPC.Error.to_map(error)
%{
"code" => -32001,
"message" => "Task not found",
"data" => [
%{
"@type" => "type.googleapis.com/google.rpc.ErrorInfo",
"domain" => "a2a-protocol.org",
"reason" => "TASK_NOT_FOUND"
}
]
}
Summary
Functions
Builds an authenticated extended card not configured error (-32007).
Builds a content type not supported error (-32005).
Builds an extension support required error (-32008).
Builds an internal error (-32603).
Builds an invalid agent response error (-32006).
Builds an invalid params error (-32602).
Builds an invalid request error (-32600).
Builds a method not found error (-32601).
Builds a parse error (-32700).
Builds a push notification not supported error (-32003).
Builds a task not cancelable error (-32002).
Builds a task not found error (-32001).
Converts an error struct to a JSON-ready map.
Builds an unsupported operation error (-32004).
Builds a version not supported error (-32009).
Types
Functions
Builds an authenticated extended card not configured error (-32007).
Builds a content type not supported error (-32005).
Builds an extension support required error (-32008).
Builds an internal error (-32603).
Builds an invalid agent response error (-32006).
Builds an invalid params error (-32602).
Builds an invalid request error (-32600).
Builds a method not found error (-32601).
Builds a parse error (-32700).
Builds a push notification not supported error (-32003).
Builds a task not cancelable error (-32002).
Builds a task not found error (-32001).
Converts an error struct to a JSON-ready map.
For A2A-specific codes (-32001..-32009) "data" is always an array carrying
a google.rpc.ErrorInfo object; any free-form data is preserved under its
"metadata". For standard JSON-RPC codes "data" is passed through as-is
and omitted when nil.
iex> error = A2A.JSONRPC.Error.internal_error("boom")
iex> A2A.JSONRPC.Error.to_map(error)
%{"code" => -32603, "message" => "Internal error", "data" => "boom"}
Builds an unsupported operation error (-32004).
Builds a version not supported error (-32009).