pub enum Error {
InvalidUrl {
url: String,
reason: &'static str,
},
SocketError(Error),
HttpResponseTooShort {
actual: usize,
needed: usize,
},
HttpResponseNonAsciiHello(Vec<u8>),
HttpResponseBadHello {
actual: String,
expected: String,
},
HttpResponseBadStatus(String, ParseIntError),
HttpResponseBadContentLength(String, ParseIntError),
HttpResponseContentLengthTooLarge {
length: u64,
max: u64,
},
HttpErrorCode(u16),
IncompleteResponse {
content_length: u64,
n_read: u64,
},
Json(Error),
}
Available on crate feature
simple_http
only.Expand description
Error that can happen when sending requests.
Variants§
InvalidUrl
An invalid URL was passed.
SocketError(Error)
An error occurred on the socket layer.
HttpResponseTooShort
The HTTP response was too short to even fit a HTTP 1.1 header.
HttpResponseNonAsciiHello(Vec<u8>)
The HTTP response started with a HTTP/1.1 line which was not ASCII.
HttpResponseBadHello
The HTTP response did not start with HTTP/1.1
Fields
HttpResponseBadStatus(String, ParseIntError)
Could not parse the status value as a number.
HttpResponseBadContentLength(String, ParseIntError)
Could not parse the status value as a number.
HttpResponseContentLengthTooLarge
The indicated content-length header exceeded our maximum.
Fields
HttpErrorCode(u16)
Unexpected HTTP error code (non-200).
IncompleteResponse
Received EOF before getting as many bytes as were indicated by the content-length header.
Fields
Json(Error)
JSON parsing 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()
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