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: Into<String>>(status: StatusCode, message: M) -> Self
pub fn err<T>(status: StatusCode, message: impl Into<String>) -> Result<T, Self>
pub fn bad_request<T>(message: impl Into<String>) -> Result<T, Self>
pub fn payment_required<T>(message: impl Into<String>) -> Result<T, Self>
pub fn forbidden<T>(message: impl Into<String>) -> Result<T, Self>
pub fn not_found<T>(message: impl Into<String>) -> Result<T, Self>
pub fn method_not_allowed<T>(message: impl Into<String>) -> Result<T, Self>
pub fn not_acceptable<T>(message: impl Into<String>) -> Result<T, Self>
pub fn proxy_auth_required<T>(message: impl Into<String>) -> Result<T, Self>
pub fn request_timeout<T>(message: impl Into<String>) -> Result<T, Self>
pub fn conflict<T>(message: impl Into<String>) -> Result<T, Self>
pub fn gone<T>(message: impl Into<String>) -> Result<T, Self>
pub fn length_required<T>(message: impl Into<String>) -> Result<T, Self>
pub fn precondition_failed<T>(message: impl Into<String>) -> Result<T, Self>
pub fn payload_too_large<T>(message: impl Into<String>) -> Result<T, Self>
pub fn uri_too_long<T>(message: impl Into<String>) -> Result<T, Self>
pub fn unsupported_media_type<T>(message: impl Into<String>) -> Result<T, Self>
pub fn im_a_teapot<T>(message: impl Into<String>) -> Result<T, Self>
pub fn too_many_requests<T>(message: impl Into<String>) -> Result<T, Self>
pub fn internal_server_error<T>(message: impl Into<String>) -> Result<T, Self>
pub fn not_implemented<T>(message: impl Into<String>) -> Result<T, Self>
pub fn bad_gateway<T>(message: impl Into<String>) -> Result<T, Self>
pub fn gateway_timeout<T>(message: impl Into<String>) -> Result<T, Self>
pub fn http_version_not_supported<T>( message: impl Into<String>, ) -> Result<T, Self>
pub fn ok<T>(message: impl Into<String>) -> Result<T, Self>
pub fn created<T>(message: impl Into<String>) -> Result<T, Self>
pub fn accepted<T>(message: impl Into<String>) -> Result<T, Self>
pub fn moved_permanently<T>(message: impl Into<String>) -> Result<T, Self>
pub fn found<T>(message: impl Into<String>) -> Result<T, Self>
pub fn see_other<T>(message: impl Into<String>) -> Result<T, Self>
pub fn not_modified<T>(message: impl Into<String>) -> Result<T, Self>
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§impl From<ServerFnError> for HttpError
impl From<ServerFnError> for HttpError
Source§fn from(value: ServerFnError) -> Self
fn from(value: ServerFnError) -> Self
Converts to this type from the input type.
Source§impl IntoResponse for HttpError
impl IntoResponse for HttpError
Source§fn into_response(self) -> Response
fn into_response(self) -> Response
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> 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<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.