pub struct HttpError {
pub message: String,
pub status_code: StatusCode,
}
Expand description
The error type contains a status code and a string message.
It implements IntoResponse, so can be used in axum handler.
§Example
fn handler() -> Result<impl IntoResponse, HttpError> {
Ok(())
}
Often it can to more convenient to use HttpResult
§Example
fn handler() -> HttpResult<impl IntoResponse> {
Ok(())
}
Fields§
§message: String
§status_code: StatusCode
Trait Implementations§
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