pub enum Error {
InvalidApiKey(InvalidHeaderValue),
UrlParsingError(ParseError),
BuildingClient(Error),
SendingRequest(Error),
DecodingJson(Error),
UnknownRequestError(Error),
}Expand description
Possible errors inside the wallhaven-rs crate
Variants§
InvalidApiKey(InvalidHeaderValue)
Returned when an invalid api key is provided to WallhavenClient::with_key
UrlParsingError(ParseError)
Returned when a request fails to build the url from the provided parameters, usually means the parameters are wrong
BuildingClient(Error)
Returned when building WallhavenClient
This error is thrown when building the rewqest client,
this means that its probably the library’s fault if this happens (it probably will not happen though)
and you should open an issue!
SendingRequest(Error)
There was some error while sending the request, you should match the underlying reqwest::Error further
DecodingJson(Error)
There was an error decoding the JSON, but the response was received successfully.
Its an error either on wallhaven’s side, if they sent a wrong json, or our side, if we wrote a bad model
UnknownRequestError(Error)
Some request error that isn’t neither Error::SendingRequest nor Error::DecodingJson
You can match further the underlying reqwest::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)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
Source§impl From<InvalidHeaderValue> for Error
impl From<InvalidHeaderValue> for Error
Source§fn from(source: InvalidHeaderValue) -> Self
fn from(source: InvalidHeaderValue) -> Self
Source§impl From<ParseError> for Error
impl From<ParseError> for Error
Source§fn from(source: ParseError) -> Self
fn from(source: ParseError) -> Self
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
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.