#[repr(C)]pub enum HttpError {
Url(String),
Io(String),
Timeout,
Http {
code: u16,
message: String,
body: Option<Vec<u8>>,
},
Json(String),
}Expand description
An error produced when an HTTP request fails.
Variants fall into two groups:
Transport errors — generated by the shell when it cannot complete the HTTP
exchange. These cross the FFI boundary and are serialized in the protocol:
Url, Io, Timeout.
Processing errors — generated on the Rust side after a response arrives. These are never serialized or visible to shells:
Http— produced byResponse::new()when the server returns a 4xx or 5xx status. At the protocol level these arrive asHttpResult::Ok;Response::new()converts them here, so app code usingcrux_http::Result<Response<T>>will see them asErr(HttpError::Http { code, .. }).Json— produced when response body deserialisation fails.
Variants§
Url(String)
The request URL could not be parsed.
Io(String)
An IO error prevented the request from completing.
Timeout
The request timed out before a response was received.
Http
Json(String)
Trait Implementations§
Source§impl<'de> Deserialize<'de> for HttpError
impl<'de> Deserialize<'de> for HttpError
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
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<ParseError> for HttpError
impl From<ParseError> for HttpError
Source§fn from(e: ParseError) -> Self
fn from(e: ParseError) -> Self
Converts to this type from the input type.
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