pub enum Error {
Show 48 variants
Http(String),
RouteNotFound(String),
MethodNotAllowed(String),
DependencyInjection(String),
ProviderNotFound(String),
Serialization(String),
Deserialization(String),
Validation(String),
Internal(String),
Forbidden(String),
Io(Error),
BadRequest(String),
Unauthorized(String),
PaymentRequired(String),
NotFound(String),
NotAcceptable(String),
ProxyAuthenticationRequired(String),
RequestTimeout(String),
Conflict(String),
Gone(String),
LengthRequired(String),
PreconditionFailed(String),
PayloadTooLarge(String),
UriTooLong(String),
UnsupportedMediaType(String),
RangeNotSatisfiable(String),
ExpectationFailed(String),
ImATeapot(String),
MisdirectedRequest(String),
UnprocessableEntity(String),
Locked(String),
FailedDependency(String),
TooEarly(String),
UpgradeRequired(String),
PreconditionRequired(String),
TooManyRequests(String),
RequestHeaderFieldsTooLarge(String),
UnavailableForLegalReasons(String),
NotImplemented(String),
BadGateway(String),
ServiceUnavailable(String),
GatewayTimeout(String),
HttpVersionNotSupported(String),
VariantAlsoNegotiates(String),
InsufficientStorage(String),
LoopDetected(String),
NotExtended(String),
NetworkAuthenticationRequired(String),
}Variants§
Http(String)
RouteNotFound(String)
MethodNotAllowed(String)
DependencyInjection(String)
ProviderNotFound(String)
Serialization(String)
Deserialization(String)
Validation(String)
Internal(String)
Forbidden(String)
Io(Error)
BadRequest(String)
PaymentRequired(String)
NotFound(String)
NotAcceptable(String)
ProxyAuthenticationRequired(String)
RequestTimeout(String)
Conflict(String)
Gone(String)
LengthRequired(String)
PreconditionFailed(String)
PayloadTooLarge(String)
UriTooLong(String)
UnsupportedMediaType(String)
RangeNotSatisfiable(String)
ExpectationFailed(String)
ImATeapot(String)
MisdirectedRequest(String)
UnprocessableEntity(String)
Locked(String)
FailedDependency(String)
TooEarly(String)
UpgradeRequired(String)
PreconditionRequired(String)
TooManyRequests(String)
RequestHeaderFieldsTooLarge(String)
NotImplemented(String)
BadGateway(String)
GatewayTimeout(String)
HttpVersionNotSupported(String)
VariantAlsoNegotiates(String)
InsufficientStorage(String)
LoopDetected(String)
NotExtended(String)
NetworkAuthenticationRequired(String)
Implementations§
Source§impl Error
impl Error
Sourcepub fn status_code(&self) -> u16
pub fn status_code(&self) -> u16
Get the HTTP status code for this error
Sourcepub fn http_status(&self) -> HttpStatus
pub fn http_status(&self) -> HttpStatus
Get the HttpStatus enum for this error
Sourcepub fn is_client_error(&self) -> bool
pub fn is_client_error(&self) -> bool
Check if this is a client error (4xx)
Sourcepub fn is_server_error(&self) -> bool
pub fn is_server_error(&self) -> bool
Check if this is a server error (5xx)
Sourcepub fn bad_request(msg: impl Into<String>) -> Self
pub fn bad_request(msg: impl Into<String>) -> Self
Create a bad request error with a message.
Create an unauthorized error with a message.
Sourcepub fn internal(msg: impl Into<String>) -> Self
pub fn internal(msg: impl Into<String>) -> Self
Create an internal server error with a message.
Sourcepub fn validation(msg: impl Into<String>) -> Self
pub fn validation(msg: impl Into<String>) -> Self
Create a validation error with a message.
Sourcepub fn rate_limited(msg: impl Into<String>) -> Self
pub fn rate_limited(msg: impl Into<String>) -> Self
Create a rate limit error with a message.
Create a service unavailable error with a message.
Trait Implementations§
Source§impl Error for Error
impl Error for Error
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()
Auto Trait Implementations§
impl Freeze for Error
impl !RefUnwindSafe for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl !UnwindSafe for Error
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> Injectable for T
impl<T> Injectable for T
Source§fn type_id_of() -> TypeIdwhere
Self: Sized,
fn type_id_of() -> TypeIdwhere
Self: Sized,
Returns the TypeId of this type (for internal use)
Source§fn type_name_of() -> &'static strwhere
Self: Sized,
fn type_name_of() -> &'static strwhere
Self: Sized,
Returns the type name for debugging
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> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
Fallible version of
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
Converts the given value to a
CompactString. Read more