pub enum Error {
Hyper(Error),
HTTP(Error),
Json(Error),
IO(Error),
Any(Error),
Urlencoded(Error),
AddrParse(AddrParseError),
InvalidStatusCode(InvalidStatusCode),
MissingParam {
name: String,
},
InvalidParam {
name: String,
expected: &'static str,
err: String,
},
Message {
msg: String,
},
Session(SessionError),
}Expand description
The error type for the desirable framework.
Represents all possible errors that can occur during request handling.
Uses thiserror for ergonomic error definitions and conversions.
§Example
ⓘ
use desirable::Error;
async fn handler() -> Result<String, Error> {
Err(Error::Message {
msg: "Something went wrong".to_string(),
})
}Variants§
Hyper(Error)
Hyper I/O error
HTTP(Error)
HTTP protocol error
Json(Error)
JSON serialization/deserialization error
IO(Error)
I/O error (file operations, etc.)
Any(Error)
Generic error wrapped in anyhow
Urlencoded(Error)
URL query string parsing error
AddrParse(AddrParseError)
Socket address parsing error
InvalidStatusCode(InvalidStatusCode)
Invalid HTTP status code
MissingParam
Missing URL path parameter
InvalidParam
Invalid path parameter value
Fields
Message
Custom error message
Session(SessionError)
Session error
Trait Implementations§
Source§impl Error for Error
impl Error for Error
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<AddrParseError> for Error
impl From<AddrParseError> for Error
Source§fn from(source: AddrParseError) -> Self
fn from(source: AddrParseError) -> Self
Converts to this type from the input type.
Source§impl From<InvalidStatusCode> for Error
impl From<InvalidStatusCode> for Error
Source§fn from(source: InvalidStatusCode) -> Self
fn from(source: InvalidStatusCode) -> Self
Converts to this type from the input type.
Source§impl From<SessionError> for Error
impl From<SessionError> for Error
Source§fn from(source: SessionError) -> Self
fn from(source: SessionError) -> Self
Converts to this type from the input type.
Source§impl IntoResponse for Error
impl IntoResponse for Error
Source§fn into_response(self) -> Result
fn into_response(self) -> Result
Converts this type into a response. Read more
Auto Trait Implementations§
impl Freeze for Error
impl !RefUnwindSafe for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl !UnwindSafe for Error
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