#[non_exhaustive]pub struct A2aError {
pub code: ErrorCode,
pub message: String,
pub data: Option<Value>,
}Expand description
The canonical error type for A2A protocol operations.
Carries an ErrorCode, a human-readable message, and an optional
data payload (arbitrary JSON) for additional diagnostics.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.code: ErrorCodeMachine-readable error code.
message: StringHuman-readable error message.
data: Option<Value>Optional structured error details.
Implementations§
Source§impl A2aError
impl A2aError
Sourcepub fn new(code: ErrorCode, message: impl Into<String>) -> A2aError
pub fn new(code: ErrorCode, message: impl Into<String>) -> A2aError
Creates a new A2aError with the given code and message.
Sourcepub fn with_data(
code: ErrorCode,
message: impl Into<String>,
data: Value,
) -> A2aError
pub fn with_data( code: ErrorCode, message: impl Into<String>, data: Value, ) -> A2aError
Creates a new A2aError with the given code, message, and data.
Sourcepub fn task_not_found(task_id: impl Display) -> A2aError
pub fn task_not_found(task_id: impl Display) -> A2aError
Creates a “Task not found” error for the given task ID string.
Sourcepub fn task_not_cancelable(task_id: impl Display) -> A2aError
pub fn task_not_cancelable(task_id: impl Display) -> A2aError
Creates a “Task not cancelable” error.
Sourcepub fn internal(msg: impl Into<String>) -> A2aError
pub fn internal(msg: impl Into<String>) -> A2aError
Creates an internal error with the provided message.
Sourcepub fn invalid_params(msg: impl Into<String>) -> A2aError
pub fn invalid_params(msg: impl Into<String>) -> A2aError
Creates an “Invalid params” error.
Sourcepub fn unsupported_operation(msg: impl Into<String>) -> A2aError
pub fn unsupported_operation(msg: impl Into<String>) -> A2aError
Creates an “Unsupported operation” error.
Sourcepub fn parse_error(msg: impl Into<String>) -> A2aError
pub fn parse_error(msg: impl Into<String>) -> A2aError
Creates a “Parse error” error.
Sourcepub fn invalid_agent_response(msg: impl Into<String>) -> A2aError
pub fn invalid_agent_response(msg: impl Into<String>) -> A2aError
Creates an “Invalid agent response” error.
Sourcepub fn extended_card_not_configured(msg: impl Into<String>) -> A2aError
pub fn extended_card_not_configured(msg: impl Into<String>) -> A2aError
Creates an “Extended agent card not configured” error.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for A2aError
impl<'de> Deserialize<'de> for A2aError
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<A2aError, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<A2aError, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Error for A2aError
impl Error for A2aError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()