pub enum GleifError {
ReqwestError(Error),
ReqwestMiddlewareError(Error),
UrlParseError(ParseError),
SerdeError(Error),
IoError(Error),
ResponseError(ResponseContent),
ParseError {
kind: ParseErrorKind,
message: String,
},
}
Expand description
Errors that can occur when using the GLEIF API client.
Variants§
ReqwestError(Error)
Error from reqwest directly
ReqwestMiddlewareError(Error)
Error from reqwest_middleware
UrlParseError(ParseError)
Error when the URL is invalid
SerdeError(Error)
Error from serde_json
IoError(Error)
Error from std::io
ResponseError(ResponseContent)
Error with attached response content
ParseError
Error when parsing a field or value fails
Fields
kind: ParseErrorKind
The kind of parse error.
Implementations§
Source§impl GleifError
impl GleifError
Sourcepub fn url(&self) -> Option<&Url>
pub fn url(&self) -> Option<&Url>
Returns the URL associated with this error, if available.
This will extract the URL from reqwest_middleware::Error
or reqwest::Error
if present.
Sourcepub fn url_mut(&mut self) -> Option<&mut Url>
pub fn url_mut(&mut self) -> Option<&mut Url>
Returns a mutable reference to the URL related to this error.
This is useful if you need to remove sensitive information from the URL (e.g. an API key in the query), but do not want to remove the URL entirely.
Sourcepub fn with_url(self, url: Url) -> Self
pub fn with_url(self, url: Url) -> Self
Returns a new error with the given URL attached (overwriting any existing).
Sourcepub fn without_url(self) -> Self
pub fn without_url(self) -> Self
Returns an error with the URL removed (if, for example, it contains sensitive information).
Sourcepub fn is_middleware(&self) -> bool
pub fn is_middleware(&self) -> bool
Returns true if this error originated from middleware.
Sourcepub fn is_builder(&self) -> bool
pub fn is_builder(&self) -> bool
Returns true if this error originated from the builder.
Sourcepub fn is_redirect(&self) -> bool
pub fn is_redirect(&self) -> bool
Returns true if this error is a redirect error.
Sourcepub fn is_timeout(&self) -> bool
pub fn is_timeout(&self) -> bool
Returns true if this error is a timeout error.
Sourcepub fn is_request(&self) -> bool
pub fn is_request(&self) -> bool
Returns true if this error is a request error.
Sourcepub fn is_connect(&self) -> bool
pub fn is_connect(&self) -> bool
Returns true if this error is a connection error.
Sourcepub fn is_body(&self) -> bool
pub fn is_body(&self) -> bool
Returns true if this error is related to the request or response body.
Sourcepub fn status(&self) -> Option<StatusCode>
pub fn status(&self) -> Option<StatusCode>
Returns the HTTP status code associated with this error, if available.
Trait Implementations§
Source§impl Debug for GleifError
impl Debug for GleifError
Source§impl Display for GleifError
impl Display for GleifError
Source§impl Error for GleifError
impl Error for GleifError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
Source§impl From<Error> for GleifError
impl From<Error> for GleifError
Source§impl From<Error> for GleifError
impl From<Error> for GleifError
Source§impl From<Error> for GleifError
impl From<Error> for GleifError
Source§impl From<Error> for GleifError
impl From<Error> for GleifError
Source§impl From<ParseError> for GleifError
impl From<ParseError> for GleifError
Source§fn from(e: ParseError) -> Self
fn from(e: ParseError) -> Self
Auto Trait Implementations§
impl Freeze for GleifError
impl !RefUnwindSafe for GleifError
impl Send for GleifError
impl Sync for GleifError
impl Unpin for GleifError
impl !UnwindSafe for GleifError
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string
, but without panic on OOM.