pub struct HttpError {
pub code: u32,
pub message: String,
pub status: Option<u16>,
}Fields§
§code: u32The WinHTTP or GetLastError code; 0 for failures with no OS code.
message: StringReadable as-is in a MessageBox or the log.
status: Option<u16>Set when a response arrived, so 401/403 can be told from “unreachable”.
Implementations§
Source§impl HttpError
impl HttpError
Sourcepub(super) fn last(context: &str) -> HttpError
pub(super) fn last(context: &str) -> HttpError
Renders GetLastError immediately, while the thread’s error is still ours.
Sourcepub fn parse(message: impl Into<String>) -> HttpError
pub fn parse(message: impl Into<String>) -> HttpError
A reachable server sent a body that could not be understood, which a retry will not fix.
pub(super) fn logical( message: impl Into<String>, status: Option<u16>, ) -> HttpError
pub fn cancelled() -> HttpError
Sourcepub fn is_cancelled(&self) -> bool
pub fn is_cancelled(&self) -> bool
The caller asked to stop, which is not a failure to report.
Sourcepub fn is_transient(&self) -> bool
pub fn is_transient(&self) -> bool
Whether trying again could succeed: no response at all, or one that says the server is busy or broken. A 401 or 404 will not change.
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