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, ) -> Self
pub fn with_message( status: StatusCode, code: impl Into<Cow<'static, str>>, message: impl Into<Cow<'static, str>>, ) -> Self
pub fn bad_request( code: impl Into<Cow<'static, str>>, message: impl Into<Cow<'static, str>>, ) -> Self
pub const fn forbidden() -> Self
pub const fn not_found() -> Self
pub const fn too_many_requests() -> Self
Sourcepub fn internal(detail: impl Display) -> Self
pub fn internal(detail: impl Display) -> Self
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()
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