pub enum LoaderError {
Unauthorized,
Forbidden(String),
NotFound(String),
Server(ServerError),
}Expand description
Failure modes a route loader can return.
Unauthorized and Forbidden flow through the existing
RouteRejection chain — the loader doesn’t have to know
that the auth plugin is the eventual handler. NotFound and
Server likewise dispatch through the rejection chain so apps
can wire a single error surface that handles both
guard-rejection and loader-failure.
From<ServerError> lets a loader body call ? on a
#[server] invocation and surface the right router signal
automatically.
Variants§
Implementations§
Source§impl LoaderError
impl LoaderError
Sourcepub fn to_rejection(&self) -> RouteRejection
pub fn to_rejection(&self) -> RouteRejection
Convert a loader failure into the matching route rejection.
The dynamic message string is dropped at this boundary;
per RFC-078 §5.10.7 the rejection chain operates on stable
closed-set identifiers, never on user-visible error
strings. Apps that need to surface the original message
should consume LoaderError directly through a custom
route-error component (see RouteErrorSurface).