#[non_exhaustive]pub enum ServerError {
Show 14 variants
TaskNotFound(TaskId),
TaskNotCancelable(TaskId),
InvalidParams(String),
Serialization(Error),
Http(Error),
HttpClient(String),
Transport(String),
PushNotSupported,
Internal(String),
MethodNotFound(String),
Protocol(A2aError),
PayloadTooLarge(String),
UnsupportedOperation(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
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.
UnsupportedOperation(String)
The operation is not supported for the current task state (e.g. sending a message to a terminal task, subscribing to a completed task).
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 |
UnsupportedOperation | UnsupportedOperation |
| 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)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
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
Source§impl From<Error> for ServerError
impl From<Error> for ServerError
Source§fn from(e: Error) -> ServerError
fn from(e: Error) -> ServerError
Source§impl From<Error> for ServerError
impl From<Error> for ServerError
Source§fn from(e: Error) -> ServerError
fn from(e: Error) -> ServerError
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
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request