#[non_exhaustive]pub enum ServerError {
Show 13 variants
TaskNotFound(TaskId),
TaskNotCancelable(TaskId),
InvalidParams(String),
Serialization(Error),
Http(Error),
HttpClient(String),
Transport(String),
PushNotSupported,
Internal(String),
MethodNotFound(String),
Protocol(A2aError),
PayloadTooLarge(String),
InvalidStateTransition {
task_id: TaskId,
from: TaskState,
to: TaskState,
},
}Expand description
Server framework error type.
Each variant maps to a specific A2A ErrorCode via to_a2a_error.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
TaskNotFound(TaskId)
The requested task was not found.
TaskNotCancelable(TaskId)
The task is in a terminal state and cannot be canceled.
InvalidParams(String)
Invalid method parameters.
Serialization(Error)
JSON serialization/deserialization failure.
Http(Error)
Hyper HTTP error.
HttpClient(String)
HTTP client-side error (e.g. push notification delivery).
Transport(String)
Transport-layer error.
PushNotSupported
The agent does not support push notifications.
Internal(String)
An internal server error.
MethodNotFound(String)
The requested JSON-RPC method was not found.
Protocol(A2aError)
An A2A protocol error propagated from the executor.
PayloadTooLarge(String)
The request body exceeds the configured size limit.
InvalidStateTransition
An invalid task state transition was attempted.
Implementations§
Source§impl ServerError
impl ServerError
Sourcepub fn to_a2a_error(&self) -> A2aError
pub fn to_a2a_error(&self) -> A2aError
Converts this server error into an A2aError suitable for wire responses.
§Mapping
| Variant | ErrorCode |
|---|---|
TaskNotFound | TaskNotFound |
TaskNotCancelable | TaskNotCancelable |
InvalidParams | InvalidParams |
Serialization | ParseError |
MethodNotFound | MethodNotFound |
PushNotSupported | PushNotificationNotSupported |
| everything else | InternalError |
Trait Implementations§
Source§impl Debug for ServerError
impl Debug for ServerError
Source§impl Display for ServerError
impl Display for ServerError
Source§impl Error for ServerError
impl Error for ServerError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Source§impl From<A2aError> for ServerError
impl From<A2aError> for ServerError
Source§fn from(e: A2aError) -> ServerError
fn from(e: A2aError) -> ServerError
Converts to this type from the input type.
Source§impl From<Error> for ServerError
impl From<Error> for ServerError
Source§fn from(e: Error) -> ServerError
fn from(e: Error) -> ServerError
Converts to this type from the input type.
Source§impl From<Error> for ServerError
impl From<Error> for ServerError
Source§fn from(e: Error) -> ServerError
fn from(e: Error) -> ServerError
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for ServerError
impl !RefUnwindSafe for ServerError
impl Send for ServerError
impl Sync for ServerError
impl Unpin for ServerError
impl UnsafeUnpin for ServerError
impl !UnwindSafe for ServerError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more