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(). HttpErrors occur when hyper is unable to complete the request. UriErrors 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

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

The lower-level source of this error, if any. Read more

🔬 This is a nightly-only experimental API. (backtrace)

Returns a stack backtrace, if available, of where this error occurred. Read more

👎 Deprecated since 1.42.0:

use the Display impl or to_string()

👎 Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.