pub struct HttpError {
pub status: StatusCode,
pub message: Option<String>,
}Expand description
An error type that wraps an HTTP status code and optional message.
Fields§
§status: StatusCode§message: Option<String>Implementations§
Source§impl HttpError
impl HttpError
pub fn new<M>(status: StatusCode, message: M) -> HttpError
pub fn err<T>( status: StatusCode, message: impl Into<String>, ) -> Result<T, HttpError>
pub fn bad_request<T>(message: impl Into<String>) -> Result<T, HttpError>
pub fn payment_required<T>(message: impl Into<String>) -> Result<T, HttpError>
pub fn forbidden<T>(message: impl Into<String>) -> Result<T, HttpError>
pub fn not_found<T>(message: impl Into<String>) -> Result<T, HttpError>
pub fn method_not_allowed<T>(message: impl Into<String>) -> Result<T, HttpError>
pub fn not_acceptable<T>(message: impl Into<String>) -> Result<T, HttpError>
pub fn proxy_auth_required<T>( message: impl Into<String>, ) -> Result<T, HttpError>
pub fn request_timeout<T>(message: impl Into<String>) -> Result<T, HttpError>
pub fn conflict<T>(message: impl Into<String>) -> Result<T, HttpError>
pub fn gone<T>(message: impl Into<String>) -> Result<T, HttpError>
pub fn length_required<T>(message: impl Into<String>) -> Result<T, HttpError>
pub fn precondition_failed<T>( message: impl Into<String>, ) -> Result<T, HttpError>
pub fn payload_too_large<T>(message: impl Into<String>) -> Result<T, HttpError>
pub fn uri_too_long<T>(message: impl Into<String>) -> Result<T, HttpError>
pub fn unsupported_media_type<T>( message: impl Into<String>, ) -> Result<T, HttpError>
pub fn im_a_teapot<T>(message: impl Into<String>) -> Result<T, HttpError>
pub fn too_many_requests<T>(message: impl Into<String>) -> Result<T, HttpError>
pub fn internal_server_error<T>( message: impl Into<String>, ) -> Result<T, HttpError>
pub fn not_implemented<T>(message: impl Into<String>) -> Result<T, HttpError>
pub fn bad_gateway<T>(message: impl Into<String>) -> Result<T, HttpError>
pub fn gateway_timeout<T>(message: impl Into<String>) -> Result<T, HttpError>
pub fn http_version_not_supported<T>( message: impl Into<String>, ) -> Result<T, HttpError>
pub fn ok<T>(message: impl Into<String>) -> Result<T, HttpError>
pub fn created<T>(message: impl Into<String>) -> Result<T, HttpError>
pub fn accepted<T>(message: impl Into<String>) -> Result<T, HttpError>
pub fn moved_permanently<T>(message: impl Into<String>) -> Result<T, HttpError>
pub fn found<T>(message: impl Into<String>) -> Result<T, HttpError>
pub fn see_other<T>(message: impl Into<String>) -> Result<T, HttpError>
pub fn not_modified<T>(message: impl Into<String>) -> Result<T, HttpError>
Trait Implementations§
Source§impl Error for HttpError
impl Error for HttpError
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<HttpError> for ServerFnError
impl From<HttpError> for ServerFnError
Source§fn from(value: HttpError) -> ServerFnError
fn from(value: HttpError) -> ServerFnError
Converts to this type from the input type.
Source§impl From<ServerFnError> for HttpError
impl From<ServerFnError> for HttpError
Source§fn from(value: ServerFnError) -> HttpError
fn from(value: ServerFnError) -> HttpError
Converts to this type from the input type.
Source§impl IntoResponse for HttpError
impl IntoResponse for HttpError
Source§fn into_response(self) -> Response<Body>
fn into_response(self) -> Response<Body>
Create a response.
impl StructuralPartialEq for HttpError
Auto Trait Implementations§
impl Freeze for HttpError
impl RefUnwindSafe for HttpError
impl Send for HttpError
impl Sync for HttpError
impl Unpin for HttpError
impl UnwindSafe for HttpError
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<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§impl<T> InitializeFromFunction<T> for T
impl<T> InitializeFromFunction<T> for T
Source§fn initialize_from_function(f: fn() -> T) -> T
fn initialize_from_function(f: fn() -> T) -> T
Create an instance of this type from an initialization function
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> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<Ret> SpawnIfAsync<(), Ret> for Ret
impl<Ret> SpawnIfAsync<(), Ret> for Ret
Source§impl<T, O> SuperFrom<T> for Owhere
O: From<T>,
impl<T, O> SuperFrom<T> for Owhere
O: From<T>,
Source§fn super_from(input: T) -> O
fn super_from(input: T) -> O
Convert from a type to another type.
Source§impl<T, O, M> SuperInto<O, M> for Twhere
O: SuperFrom<T, M>,
impl<T, O, M> SuperInto<O, M> for Twhere
O: SuperFrom<T, M>,
Source§fn super_into(self) -> O
fn super_into(self) -> O
Convert from a type to another type.
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.