Struct salvo_core::http::errors::StatusError
source · #[non_exhaustive]pub struct StatusError {
pub code: StatusCode,
pub name: String,
pub brief: String,
pub detail: Option<String>,
pub cause: Option<Box<dyn StdError + Sync + Send + 'static>>,
}
Expand description
StatusError contains http error information.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.code: StatusCode
Http error status code.
name: String
Http error name.
brief: String
Brief information about http error.
detail: Option<String>
Detail information about http error.
cause: Option<Box<dyn StdError + Sync + Send + 'static>>
Cause about http error. This field is only used for internal debugging and only used in debug mode.
Implementations§
source§impl StatusError
impl StatusError
sourcepub fn bad_request() -> StatusError
pub fn bad_request() -> StatusError
The request could not be understood by the server due to malformed syntax.
400 Bad Request [RFC7231, Section 6.5.1]
The request requires user authentication.
401 Unauthorized [RFC7235, Section 3.1]
sourcepub fn payment_required() -> StatusError
pub fn payment_required() -> StatusError
The request could not be processed due to lack of payment.
402 Payment Required [RFC7231, Section 6.5.2]
sourcepub fn forbidden() -> StatusError
pub fn forbidden() -> StatusError
The server refused to authorize the request.
403 Forbidden [RFC7231, Section 6.5.3]
sourcepub fn not_found() -> StatusError
pub fn not_found() -> StatusError
The requested resource could not be found.
404 Not Found [RFC7231, Section 6.5.4]
sourcepub fn method_not_allowed() -> StatusError
pub fn method_not_allowed() -> StatusError
The request method is not supported for the requested resource.
405 Method Not Allowed [RFC7231, Section 6.5.5]
sourcepub fn not_acceptable() -> StatusError
pub fn not_acceptable() -> StatusError
The requested resource is capable of generating only content not acceptable according to the Accept headers sent in the request.
406 Not Acceptable [RFC7231, Section 6.5.6]
sourcepub fn proxy_authentication_required() -> StatusError
pub fn proxy_authentication_required() -> StatusError
Authentication with the proxy is required.
407 Proxy Authentication Required [RFC7235, Section 3.2]
sourcepub fn request_timeout() -> StatusError
pub fn request_timeout() -> StatusError
The server timed out waiting for the request.
408 Request Timeout [RFC7231, Section 6.5.7]
sourcepub fn conflict() -> StatusError
pub fn conflict() -> StatusError
The request could not be processed because of a conflict in the request.
409 Conflict [RFC7231, Section 6.5.8]
sourcepub fn gone() -> StatusError
pub fn gone() -> StatusError
The resource requested is no longer available and will not be available again.
410 Gone [RFC7231, Section 6.5.9]
sourcepub fn length_required() -> StatusError
pub fn length_required() -> StatusError
The request did not specify the length of its content, which is required by the requested resource.
411 Length Required [RFC7231, Section 6.5.10]
sourcepub fn precondition_failed() -> StatusError
pub fn precondition_failed() -> StatusError
The server does not meet one of the preconditions specified in the request.
412 Precondition Failed [RFC7232, Section 4.2]
sourcepub fn payload_too_large() -> StatusError
pub fn payload_too_large() -> StatusError
The request is larger than the server is willing or able to process.
413 Payload Too Large [RFC7231, Section 6.5.11]
sourcepub fn uri_too_long() -> StatusError
pub fn uri_too_long() -> StatusError
The URI provided was too long for the server to process.
414 URI Too Long [RFC7231, Section 6.5.12]
sourcepub fn unsupported_media_type() -> StatusError
pub fn unsupported_media_type() -> StatusError
The request entity has a media type which the server or resource does not support.
415 Unsupported Media Type [RFC7231, Section 6.5.13]
sourcepub fn range_not_satisfiable() -> StatusError
pub fn range_not_satisfiable() -> StatusError
The portion of the requested file cannot be supplied by the server.
416 Range Not Satisfiable [RFC7233, Section 4.4]
sourcepub fn expectation_failed() -> StatusError
pub fn expectation_failed() -> StatusError
The server cannot meet the requirements of the expect request-header field.
417 Expectation Failed [RFC7231, Section 6.5.14]
sourcepub fn im_a_teapot() -> StatusError
pub fn im_a_teapot() -> StatusError
I was requested to brew coffee, and I am a teapot.
418 I’m a teapot [curiously not registered by IANA but RFC2324]
sourcepub fn misdirected_request() -> StatusError
pub fn misdirected_request() -> StatusError
The server cannot produce a response for this request.
421 Misdirected Request RFC7540, Section 9.1.2
sourcepub fn unprocessable_entity() -> StatusError
pub fn unprocessable_entity() -> StatusError
The request was well-formed but was unable to be followed due to semantic errors.
422 Unprocessable Entity [RFC4918]
sourcepub fn locked() -> StatusError
pub fn locked() -> StatusError
The source or destination resource of a method is locked.
423 Locked [RFC4918]
sourcepub fn failed_dependency() -> StatusError
pub fn failed_dependency() -> StatusError
The method could not be performed on the resource because the requested action depended on another action and that action failed.
424 Failed Dependency [RFC4918]
sourcepub fn upgrade_required() -> StatusError
pub fn upgrade_required() -> StatusError
Switching to the protocol in the Upgrade header field is required.
426 Upgrade Required [RFC7231, Section 6.5.15]
sourcepub fn precondition_required() -> StatusError
pub fn precondition_required() -> StatusError
The server requires the request to be conditional.
428 Precondition Required [RFC6585]
sourcepub fn too_many_requests() -> StatusError
pub fn too_many_requests() -> StatusError
Too many requests have been received recently.
429 Too Many Requests [RFC6585]
sourcepub fn request_header_fields_toolarge() -> StatusError
pub fn request_header_fields_toolarge() -> StatusError
The server is unwilling to process the request because either an individual header field, or all the header fields collectively, are too large.
431 Request Header Fields Too Large [RFC6585]
The requested resource is unavailable due to a legal demand to deny access to this resource.
451 Unavailable For Legal Reasons [RFC7725]
sourcepub fn internal_server_error() -> StatusError
pub fn internal_server_error() -> StatusError
The server encountered an internal error while processing this request.
500 Internal Server Error [RFC7231, Section 6.6.1]
sourcepub fn not_implemented() -> StatusError
pub fn not_implemented() -> StatusError
The server either does not recognize the request method, or it lacks the ability to fulfill the request.
501 Not Implemented [RFC7231, Section 6.6.2]
sourcepub fn bad_gateway() -> StatusError
pub fn bad_gateway() -> StatusError
Received an invalid response from an inbound server it accessed while attempting to fulfill the request.
502 Bad Gateway [RFC7231, Section 6.6.3]
The server is currently unavailable.
503 Service Unavailable [RFC7231, Section 6.6.4]
sourcepub fn gateway_timeout() -> StatusError
pub fn gateway_timeout() -> StatusError
The server did not receive a timely response from an upstream server.
504 Gateway Timeout [RFC7231, Section 6.6.5]
sourcepub fn http_version_not_supported() -> StatusError
pub fn http_version_not_supported() -> StatusError
The server does not support, or refuses to support, the major version of HTTP that was used in the request message.
505 HTTP Version Not Supported [RFC7231, Section 6.6.6]
sourcepub fn variant_also_negotiates() -> StatusError
pub fn variant_also_negotiates() -> StatusError
The server has an internal configuration error.
506 Variant Also Negotiates [RFC2295]
sourcepub fn insufficient_storage() -> StatusError
pub fn insufficient_storage() -> StatusError
The method could not be performed on the resource because the server is unable to store the representation needed to successfully complete the request.
507 Insufficient Storage [RFC4918]
sourcepub fn loop_detected() -> StatusError
pub fn loop_detected() -> StatusError
the server terminated an operation because it encountered an infinite loop while processing a request with “Depth: infinity”.
508 Loop Detected [RFC5842]
sourcepub fn not_extended() -> StatusError
pub fn not_extended() -> StatusError
Further extensions to the request are required for the server to fulfill it.
510 Not Extended [RFC2774]
sourcepub fn network_authentication_required() -> StatusError
pub fn network_authentication_required() -> StatusError
the client needs to authenticate to gain network access.
511 Network Authentication Required [RFC6585]
source§impl StatusError
impl StatusError
sourcepub fn from_code(code: StatusCode) -> Option<StatusError>
pub fn from_code(code: StatusCode) -> Option<StatusError>
Create new StatusError
with code. If code is not error, it will be None
.
Trait Implementations§
source§impl Debug for StatusError
impl Debug for StatusError
source§impl Display for StatusError
impl Display for StatusError
source§impl Error for StatusError
impl Error for StatusError
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
source§impl From<StatusError> for Error
impl From<StatusError> for Error
source§fn from(e: StatusError) -> Error
fn from(e: StatusError) -> Error
Auto Trait Implementations§
impl Freeze for StatusError
impl !RefUnwindSafe for StatusError
impl Send for StatusError
impl Sync for StatusError
impl Unpin for StatusError
impl !UnwindSafe for StatusError
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<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> WithSubscriber for T
impl<T> WithSubscriber for T
source§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
source§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
source§impl<P> Writer for P
impl<P> Writer for P
source§fn write<'life0, 'life1, 'life2, 'async_trait>(
self,
_req: &'life0 mut Request,
_depot: &'life1 mut Depot,
res: &'life2 mut Response
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
P: 'async_trait,
fn write<'life0, 'life1, 'life2, 'async_trait>(
self,
_req: &'life0 mut Request,
_depot: &'life1 mut Depot,
res: &'life2 mut Response
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
P: 'async_trait,
Response
.