rusty_axml/
errors.rs

1//! Errors module
2//!
3//! This module simply enumerates the possible errors we can
4//! encounter and their associated error messages. We use
5//! `thiserror` for the heavy lifting.
6
7use thiserror::Error;
8
9#[derive(Error, Debug)]
10pub enum AxmlError {
11    #[error("reading from the cursor of bytes")]
12    IoError(#[from] std::io::Error),
13    #[error("cannot decode string from UTF-16")]
14    Utf16DecodeError(#[from] std::char::DecodeUtf16Error),
15    #[error("cannot decode string from UTF-8")]
16    Utf8StrDecodeError(#[from] std::str::Utf8Error),
17    #[error("cannot decode string from UTF-8")]
18    Utf8StringDecodeError(#[from] std::string::FromUtf8Error),
19    #[error("string not in the string pool")]
20    StringPoolError,
21    #[error("unknown namespace")]
22    NamespaceError,
23    #[error("Zip file error")]
24    ZipFileError(#[from] zip::result::ZipError),
25    #[error("XML encoding error")]
26    XmlEncodingError(#[from] quick_xml::Error),
27}