1use thiserror::Error;
4
5#[derive(Debug, Error)]
7pub enum A2aError {
8 #[error("invalid state transition: {from:?} -> {to:?}")]
10 InvalidTransition {
11 from: crate::task::TaskState,
13 to: crate::task::TaskState,
15 },
16
17 #[error("invalid message-state transition: {from:?} -> {to:?}")]
19 InvalidMessageTransition {
20 from: crate::message::MsgState,
22 to: crate::message::MsgState,
24 },
25
26 #[error("claim conflict: {0}")]
28 ClaimConflict(String),
29
30 #[error("serde error: {0}")]
32 Serde(String),
33}
34
35impl From<serde_json::Error> for A2aError {
36 fn from(e: serde_json::Error) -> Self {
37 A2aError::Serde(e.to_string())
38 }
39}
40
41pub type A2aResult<T> = std::result::Result<T, A2aError>;