pub enum ServerFnError {
ServerError {
message: String,
code: u16,
details: Option<Value>,
},
Request(RequestError),
StreamError(String),
Registration(String),
UnsupportedRequestMethod(String),
MiddlewareError(String),
Deserialization(String),
Serialization(String),
Args(String),
MissingArg(String),
Response(String),
}Expand description
The error type for the server function system. This enum encompasses all possible errors that can occur during the registration, invocation, and processing of server functions.
Variants§
ServerError
Occurs when there is an error while actually running the function on the server.
The details field can optionally contain additional structured information about the error.
When passing typed errors from the server to the client, the details field contains the serialized
representation of the error.
Fields
Request(RequestError)
Occurs on the client if there is a network error while trying to run function on server.
StreamError(String)
Occurs on the client if there is an error while trying to read the response body as a stream.
Registration(String)
Error while trying to register the server function (only occurs in case of poisoned RwLock).
UnsupportedRequestMethod(String)
Occurs on the client if trying to use an unsupported HTTP method when building a request.
MiddlewareError(String)
Occurs when there is an error while actually running the middleware on the server.
Deserialization(String)
Occurs on the client if there is an error deserializing the server’s response.
Serialization(String)
Occurs on the client if there is an error serializing the server function arguments.
Args(String)
Occurs on the server if there is an error deserializing one of the arguments that’s been sent.
MissingArg(String)
Occurs on the server if there’s a missing argument.
Response(String)
Occurs on the server if there is an error creating an HTTP response.
Implementations§
Source§impl ServerFnError
impl ServerFnError
Sourcepub fn new(f: impl ToString) -> ServerFnError
pub fn new(f: impl ToString) -> ServerFnError
Create a new server error (status code 500) with a message.
Sourcepub async fn from_axum_response(resp: Response<Body>) -> ServerFnError
pub async fn from_axum_response(resp: Response<Body>) -> ServerFnError
Create a new server error (status code 500) with a message and details.
Trait Implementations§
Source§impl AsStatusCode for ServerFnError
impl AsStatusCode for ServerFnError
fn as_status_code(&self) -> StatusCode
Source§impl Clone for ServerFnError
impl Clone for ServerFnError
Source§fn clone(&self) -> ServerFnError
fn clone(&self) -> ServerFnError
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ServerFnError
impl Debug for ServerFnError
Source§impl<'de> Deserialize<'de> for ServerFnError
impl<'de> Deserialize<'de> for ServerFnError
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ServerFnError, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ServerFnError, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Display for ServerFnError
impl Display for ServerFnError
Source§impl Error for ServerFnError
impl Error for ServerFnError
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
Source§impl From<Error> for ServerFnError
impl From<Error> for ServerFnError
Source§fn from(value: Error) -> ServerFnError
fn from(value: Error) -> ServerFnError
Source§impl From<Error> for ServerFnError
impl From<Error> for ServerFnError
Source§fn from(value: Error) -> ServerFnError
fn from(value: Error) -> ServerFnError
Source§impl From<HttpError> for ServerFnError
impl From<HttpError> for ServerFnError
Source§fn from(value: HttpError) -> ServerFnError
fn from(value: HttpError) -> ServerFnError
Source§impl From<RequestError> for ServerFnError
impl From<RequestError> for ServerFnError
Source§fn from(value: RequestError) -> ServerFnError
fn from(value: RequestError) -> ServerFnError
Source§impl From<ServerFnError> for HttpError
impl From<ServerFnError> for HttpError
Source§fn from(value: ServerFnError) -> HttpError
fn from(value: ServerFnError) -> HttpError
Source§impl From<ServerFnError> for StatusCode
impl From<ServerFnError> for StatusCode
Source§fn from(value: ServerFnError) -> StatusCode
fn from(value: ServerFnError) -> StatusCode
Source§impl IntoResponse for ServerFnError
impl IntoResponse for ServerFnError
Source§fn into_response(self) -> Response<Body>
fn into_response(self) -> Response<Body>
Source§impl PartialEq for ServerFnError
impl PartialEq for ServerFnError
Source§impl Serialize for ServerFnError
impl Serialize for ServerFnError
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl Eq for ServerFnError
impl StructuralPartialEq for ServerFnError
Auto Trait Implementations§
impl Freeze for ServerFnError
impl RefUnwindSafe for ServerFnError
impl Send for ServerFnError
impl Sync for ServerFnError
impl Unpin for ServerFnError
impl UnwindSafe for ServerFnError
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T, S> Handler<IntoResponseHandler, S> for T
impl<T, S> Handler<IntoResponseHandler, S> for T
Source§fn call(
self,
_req: Request<Body>,
_state: S,
) -> <T as Handler<IntoResponseHandler, S>>::Future
fn call( self, _req: Request<Body>, _state: S, ) -> <T as Handler<IntoResponseHandler, S>>::Future
Source§fn layer<L>(self, layer: L) -> Layered<L, Self, T, S>where
L: Layer<HandlerService<Self, T, S>> + Clone,
<L as Layer<HandlerService<Self, T, S>>>::Service: Service<Request<Body>>,
fn layer<L>(self, layer: L) -> Layered<L, Self, T, S>where
L: Layer<HandlerService<Self, T, S>> + Clone,
<L as Layer<HandlerService<Self, T, S>>>::Service: Service<Request<Body>>,
tower::Layer to the handler. Read moreSource§fn with_state(self, state: S) -> HandlerService<Self, T, S>
fn with_state(self, state: S) -> HandlerService<Self, T, S>
Service by providing the stateSource§impl<H, T> HandlerWithoutStateExt<T> for H
impl<H, T> HandlerWithoutStateExt<T> for H
Source§fn into_service(self) -> HandlerService<H, T, ()>
fn into_service(self) -> HandlerService<H, T, ()>
Service and no state.Source§fn into_make_service(self) -> IntoMakeService<HandlerService<H, T, ()>>
fn into_make_service(self) -> IntoMakeService<HandlerService<H, T, ()>>
MakeService and no state. Read moreSource§impl<T> InitializeFromFunction<T> for T
impl<T> InitializeFromFunction<T> for T
Source§fn initialize_from_function(f: fn() -> T) -> T
fn initialize_from_function(f: fn() -> T) -> T
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> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<Ret> SpawnIfAsync<(), Ret> for Ret
impl<Ret> SpawnIfAsync<(), Ret> for Ret
Source§impl<T, O> SuperFrom<T> for Owhere
O: From<T>,
impl<T, O> SuperFrom<T> for Owhere
O: From<T>,
Source§fn super_from(input: T) -> O
fn super_from(input: T) -> O
Source§impl<T, O, M> SuperInto<O, M> for Twhere
O: SuperFrom<T, M>,
impl<T, O, M> SuperInto<O, M> for Twhere
O: SuperFrom<T, M>,
Source§fn super_into(self) -> O
fn super_into(self) -> O
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.