pub enum HttpError {
Show 14 variants
BadRequest,
Unauthorized,
Forbidden,
NotFound,
MethodNotAllowed,
Conflict,
Gone,
UnprocessableEntity,
TooManyRequests,
PayloadTooLarge,
InternalServerError,
BadGateway,
ServiceUnavailable,
GatewayTimeout,
}Expand description
A lightweight enum of common HTTP error statuses.
Use this when you want a concise, copy-able representation of an error category without
allocating a message string. It converts into Error via From<HttpError>.
§Example
use modo::error::{Error, HttpError};
let err: Error = HttpError::NotFound.into();
assert_eq!(err.message(), "Not Found");Variants§
BadRequest
400 Bad Request
401 Unauthorized
Forbidden
403 Forbidden
NotFound
404 Not Found
MethodNotAllowed
405 Method Not Allowed
Conflict
409 Conflict
Gone
410 Gone
UnprocessableEntity
422 Unprocessable Entity
TooManyRequests
429 Too Many Requests
PayloadTooLarge
413 Payload Too Large
InternalServerError
500 Internal Server Error
BadGateway
502 Bad Gateway
503 Service Unavailable
GatewayTimeout
504 Gateway Timeout
Implementations§
Source§impl HttpError
impl HttpError
Sourcepub fn status_code(self) -> StatusCode
pub fn status_code(self) -> StatusCode
Returns the StatusCode corresponding to this variant.
Trait Implementations§
impl Copy for HttpError
impl Eq for HttpError
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 UnsafeUnpin 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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.