Enum hentai::HentaiError
source · [−]pub enum HentaiError {
IoError(Error),
BaseError(&'static str),
HttpError(Error),
UriError(InvalidUri),
SerdeError(Error),
ToStrError(ToStrError),
ConversionError(ParseIntError),
}
Expand description
Global error type for Hentai that catches all other types of errors that may occur. This still provides the original error message when printed.
The first type (IOError
) can only occur when using the Hentai::from_json()
constructor.
Typically, the cause of this is an invalid file path being provided.
BaseError
is a standard error used to indicate that an Option<> failed to be converted into
a Result<>. This occurs in the Hentai::random()
constructor after the request is sent but
the redirect header cannot be converted into a string.
HttpError
and UriError
only occur when using Hentai::new()
. HttpError
s occur when
hyper is unable to complete the request. UriError
s are usually caused
by an invalid code being provided, thus resulting in an invalid URI.
SerdeError
means that the JSON was invalid and it could not be deserialized.
ToStrError
happens when using Hentai::random()
and the redirect header cannot be converted
into a random doujin URL.
ConversionError
happens when the response from nhentai’s /random
endpoint returns a URL from which the six-digit code could not be converted into an integer.
The cause of this is currently unknown, but please crate an issue on GitHub if you know how to
fix this.
Variants
IoError(Error)
BaseError(&'static str)
HttpError(Error)
UriError(InvalidUri)
SerdeError(Error)
ToStrError(ToStrError)
ConversionError(ParseIntError)
Trait Implementations
sourceimpl Debug for HentaiError
impl Debug for HentaiError
sourceimpl Display for HentaiError
impl Display for HentaiError
sourceimpl Error for HentaiError
impl Error for HentaiError
1.30.0 · sourcefn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
The lower-level source of this error, if any. Read more
sourcefn backtrace(&self) -> Option<&Backtrace>
fn backtrace(&self) -> Option<&Backtrace>
backtrace
)Returns a stack backtrace, if available, of where this error occurred. Read more
1.0.0 · sourcefn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
sourceimpl From<&'static str> for HentaiError
impl From<&'static str> for HentaiError
sourceimpl From<Error> for HentaiError
impl From<Error> for HentaiError
sourceimpl From<Error> for HentaiError
impl From<Error> for HentaiError
sourceimpl From<Error> for HentaiError
impl From<Error> for HentaiError
sourceimpl From<InvalidUri> for HentaiError
impl From<InvalidUri> for HentaiError
sourcefn from(err: InvalidUri) -> Self
fn from(err: InvalidUri) -> Self
Converts to this type from the input type.
sourceimpl From<ParseIntError> for HentaiError
impl From<ParseIntError> for HentaiError
sourcefn from(err: ParseIntError) -> Self
fn from(err: ParseIntError) -> Self
Converts to this type from the input type.
sourceimpl From<ToStrError> for HentaiError
impl From<ToStrError> for HentaiError
sourcefn from(err: ToStrError) -> Self
fn from(err: ToStrError) -> Self
Converts to this type from the input type.
Auto Trait Implementations
impl !RefUnwindSafe for HentaiError
impl Send for HentaiError
impl Sync for HentaiError
impl Unpin for HentaiError
impl !UnwindSafe for HentaiError
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more