pub struct AuthError { /* private fields */ }Expand description
The one error type every endpoint, hook and extractor returns. It leaves the server as
{ "code": "...", "message": "..." } with status.
Implementations§
Source§impl AuthError
impl AuthError
pub const fn new( status: StatusCode, code: &'static str, message: &'static str, ) -> AuthError
pub fn with_message( status: StatusCode, code: impl Into<Cow<'static, str>>, message: impl Into<Cow<'static, str>>, ) -> AuthError
pub fn bad_request( code: impl Into<Cow<'static, str>>, message: impl Into<Cow<'static, str>>, ) -> AuthError
pub const fn forbidden() -> AuthError
pub const fn not_found() -> AuthError
Sourcepub const fn not_fresh() -> AuthError
pub const fn not_fresh() -> AuthError
403 SESSION_NOT_FRESH: the session is older than fresh_age.
pub const fn too_many_requests() -> AuthError
Sourcepub fn internal(detail: impl Display) -> AuthError
pub fn internal(detail: impl Display) -> AuthError
Logs detail server-side and returns a generic 500, so internals never reach clients.
pub fn status(&self) -> StatusCode
pub fn code(&self) -> &str
pub fn message(&self) -> &str
pub fn to_json(&self) -> Bytes
pub fn into_response(self) -> Response<Bytes>
Trait Implementations§
impl Eq for AuthError
Source§impl Error for AuthError
impl Error for AuthError
1.30.0 · 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<AdminError> for AuthError
impl From<AdminError> for AuthError
Source§fn from(error: AdminError) -> AuthError
fn from(error: AdminError) -> AuthError
Converts to this type from the input type.
Source§impl From<ApiKeyError> for AuthError
impl From<ApiKeyError> for AuthError
Source§fn from(error: ApiKeyError) -> AuthError
fn from(error: ApiKeyError) -> AuthError
Converts to this type from the input type.
Source§impl From<OrganizationError> for AuthError
impl From<OrganizationError> for AuthError
Source§fn from(error: OrganizationError) -> AuthError
fn from(error: OrganizationError) -> AuthError
Converts to this type from the input type.
Source§impl From<SocialError> for AuthError
impl From<SocialError> for AuthError
Source§fn from(err: SocialError) -> AuthError
fn from(err: SocialError) -> AuthError
Converts to this type from the input type.
Source§impl From<TwoFactorError> for AuthError
impl From<TwoFactorError> for AuthError
Source§fn from(err: TwoFactorError) -> AuthError
fn from(err: TwoFactorError) -> AuthError
Converts to this type from the input type.
Source§impl IntoResponse for AuthError
Available on crate feature axum only.Lets axum handlers return Result<T, AuthError>: the same JSON body the auth routes use.
impl IntoResponse for AuthError
Available on crate feature
axum only.Lets axum handlers return Result<T, AuthError>: the same JSON body the auth routes use.
Source§fn into_response(self) -> Response<Body>
fn into_response(self) -> Response<Body>
Create a response.
impl StructuralPartialEq for AuthError
Auto Trait Implementations§
impl Forget for AuthError
impl Freeze for AuthError
impl Move for AuthError
impl RefUnwindSafe for AuthError
impl Send for AuthError
impl Sync for AuthError
impl Unpin for AuthError
impl UnsafeUnpin for AuthError
impl UnwindSafe for AuthError
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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
Compare self to
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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
Call the handler with the given request.
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>>,
Apply a
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>
Convert the handler into a
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, ()>
Convert the handler into a
Service and no state.Source§fn into_make_service(self) -> IntoMakeService<HandlerService<H, T, ()>>
fn into_make_service(self) -> IntoMakeService<HandlerService<H, T, ()>>
Convert the handler into a
MakeService and no state. Read moreSource§fn into_make_service_with_connect_info<C>(
self,
) -> IntoMakeServiceWithConnectInfo<HandlerService<H, T, ()>, C>
fn into_make_service_with_connect_info<C>( self, ) -> IntoMakeServiceWithConnectInfo<HandlerService<H, T, ()>, C>
Convert the handler into a
MakeService which stores information
about the incoming connection and has no state. Read moreSource§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> ⓘ
Converts
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> ⓘ
Converts
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