pub enum PageError {
Redirect {
location: String,
hx: bool,
},
Rendered {
status: StatusCode,
code: &'static str,
message: String,
},
}Expand description
A failed page request.
Variants§
Redirect
Sign-in is needed: 303 + Location for a browser, HX-Redirect for
htmx.
Rendered
Anything else: the real status, plus a standalone HTML document.
Implementations§
Source§impl PageError
impl PageError
Sourcepub fn login_required(hx: bool) -> Self
pub fn login_required(hx: bool) -> Self
The redirect an expired or absent session produces.
Sourcepub fn bad_request(message: impl Into<String>) -> Self
pub fn bad_request(message: impl Into<String>) -> Self
400 — the request named something that does not exist, and said so
itself (an unparseable filter, not a missing row).
Sourcepub fn status(&self) -> StatusCode
pub fn status(&self) -> StatusCode
The status this will answer with, which for a redirect is the redirect’s own — useful mostly to tests.
Trait Implementations§
impl Eq for PageError
Source§impl Error for PageError
impl Error for PageError
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
use the Display impl or to_string()
Source§impl From<AdminError> for PageError
A 401 from the API layer means “sign in”; everything else keeps its status.
impl From<AdminError> for PageError
A 401 from the API layer means “sign in”; everything else keeps its status.
This is the one place the two error vocabularies meet, and it is a
conversion rather than a shared type on purpose: AdminError answers a
script, PageError answers a browser, and the day one grows a member the
other should not have, nothing has to be untangled.
Source§fn from(error: AdminError) -> Self
fn from(error: AdminError) -> Self
Source§impl From<Error> for PageError
Routed through AdminError so the admin_db_error log line — which
carries the table and column names the body must not — still happens exactly
once.
impl From<Error> for PageError
Routed through AdminError so the admin_db_error log line — which
carries the table and column names the body must not — still happens exactly
once.
Source§impl IntoResponse for PageError
impl IntoResponse for PageError
Source§fn into_response(self) -> Response
fn into_response(self) -> Response
impl StructuralPartialEq for PageError
Auto Trait Implementations§
impl Freeze for PageError
impl RefUnwindSafe for PageError
impl Send for PageError
impl Sync for PageError
impl Unpin for PageError
impl UnsafeUnpin for PageError
impl UnwindSafe for PageError
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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 more