EpubError

Enum EpubError 

Source
pub enum EpubError {
Show 18 variants ArchiveError { source: ZipError, }, EmptyDataError, EpubBuilderError { source: EpubBuilderError, }, FailedParsingXml, IOError { source: Error, }, MissingRequiredAttribute { tag: String, attribute: String, }, NonCanonicalEpub { expected_file: String, }, NonCanonicalFile { tag: String, }, NoSupportedFileFormat, RealtiveLinkLeakage { path: String, }, ResourceIdNotExist { id: String, }, ResourceNotFound { resource: String, }, UnrecognizedEpubVersion, UnsupportedEncryptedMethod { method: String, }, UnusableCompressionMethod { file: String, method: String, }, Utf8DecodeError { source: FromUtf8Error, }, Utf16DecodeError { source: FromUtf16Error, }, QuickXmlError { source: Error, },
}
Expand description

Types of errors that can occur during EPUB processing

This enumeration defines the various error cases that can be encountered when parsing and processing EPUB files, including file format errors, missing resources, compression issues, etc.

Variants§

§

ArchiveError

ZIP archive related errors

Errors occur when processing the ZIP structure of EPUB files, such as file corruption, unreadability, etc.

Fields

§source: ZipError
§

EmptyDataError

Data Decoding Error - Null dataw

This error occurs when trying to decode an empty stream.

§

EpubBuilderError

Fields

§

FailedParsingXml

XML parsing failure error

This error usually only occurs when there is an exception in the XML parsing process, the event listener ends abnormally, resulting in the root node not being initialized. This exception may be caused by an incorrect XML file.

§

IOError

Fields

§source: Error
§

MissingRequiredAttribute

Missing required attribute error

Triggered when an XML element in an EPUB file lacks the required attributes required by the EPUB specification.

Fields

§attribute: String
§

NonCanonicalEpub

Non-canonical EPUB structure error

This error occurs when an EPUB file lacks some files or directory structure that is required in EPUB specification.

Fields

§expected_file: String
§

NonCanonicalFile

Non-canonical file structure error

This error is triggered when the required XML elements in the specification are missing from the EPUB file.

Fields

§

NoSupportedFileFormat

Missing supported file format error

This error occurs when trying to get a resource but there isn’t any supported file format. It usually happens when there are no supported formats available in the fallback chain.

§

RealtiveLinkLeakage

Relative link leak error

This error occurs when a relative path link is outside the scope of an EPUB container, which is a security protection mechanism.

Fields

§path: String
§

ResourceIdNotExist

Unable to find the resource id error

This error occurs when trying to get a resource by id but that id doesn’t exist in the manifest.

Fields

§

ResourceNotFound

Unable to find the resource error

This error occurs when an attempt is made to get a resource but it does not exist in the EPUB container.

Fields

§resource: String
§

UnrecognizedEpubVersion

Unrecognized EPUB version error

This error occurs when parsing epub files, the library cannot directly or indirectly identify the epub version number.

§

UnsupportedEncryptedMethod

Unsupported encryption method error

This error is triggered when attempting to decrypt a resource that uses an encryption method not supported by this library.

Currently, this library only supports:

  • IDPF Font Obfuscation
  • Adobe Font Obfuscation

Fields

§method: String
§

UnusableCompressionMethod

Unusable compression method error

This error occurs when an EPUB file uses an unsupported compression method.

Fields

§file: String
§method: String
§

Utf8DecodeError

UTF-8 decoding error

This error occurs when attempting to decode byte data into a UTF-8 string but the data is not formatted correctly.

Fields

§

Utf16DecodeError

UTF-16 decoding error

This error occurs when attempting to decode byte data into a UTF-16 string but the data is not formatted correctly.

Fields

§

QuickXmlError

QuickXml error

This error occurs when parsing XML data using the QuickXml library.

Fields

§source: Error

Trait Implementations§

Source§

impl Debug for EpubError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for EpubError

Source§

fn fmt(&self, __formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for EpubError

Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0: use the Display impl or to_string()
1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<EpubBuilderError> for EpubError

Available on crate feature builder only.
Source§

fn from(value: EpubBuilderError) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for EpubError

Source§

fn from(value: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for EpubError

Source§

fn from(value: Error) -> Self

Converts to this type from the input type.
Source§

impl From<FromUtf16Error> for EpubError

Source§

fn from(value: FromUtf16Error) -> Self

Converts to this type from the input type.
Source§

impl From<FromUtf8Error> for EpubError

Source§

fn from(value: FromUtf8Error) -> Self

Converts to this type from the input type.
Source§

impl From<ZipError> for EpubError

Source§

fn from(value: ZipError) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.