pub enum EpubError {
Show 20 variants
ArchiveError {
source: ZipError,
},
EmptyDataError,
EpubBuilderError {
source: EpubBuilderError,
},
FailedParsingXml,
IOError {
source: Error,
},
MissingRequiredAttribute {
tag: String,
attribute: String,
},
MutexError,
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,
},
WalkDirError {
source: Error,
},
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.
EmptyDataError
Data Decoding Error - Null dataw
This error occurs when trying to decode an empty stream.
EpubBuilderError
Fields
source: EpubBuilderErrorFailedParsingXml
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
MissingRequiredAttribute
Missing required attribute error
Triggered when an XML element in an EPUB file lacks the required attributes required by the EPUB specification.
MutexError
Mutex error
This error occurs when a mutex is poisoned, which means that a thread has panicked while holding a lock on the mutex.
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.
NonCanonicalFile
Non-canonical file structure error
This error is triggered when the required XML elements in the specification are missing from the EPUB file.
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.
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.
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.
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
UnusableCompressionMethod
Unusable compression method error
This error occurs when an EPUB file uses an unsupported compression method.
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
source: FromUtf8ErrorUtf16DecodeError
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
source: FromUtf16ErrorWalkDirError
WalkDir error
This error occurs when using the WalkDir library to traverse the directory.
QuickXmlError
QuickXml error
This error occurs when parsing XML data using the QuickXml library.
Trait Implementations§
Source§impl Error for EpubError
impl Error for EpubError
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<EpubBuilderError> for EpubError
Available on crate feature builder only.
impl From<EpubBuilderError> for EpubError
builder only.