hff_core/
error.rs

1use thiserror::Error;
2
3/// Common error type.
4#[derive(Debug, Error)]
5pub enum Error {
6    /// Infallible errors.  I.e. they better never be hit.
7    #[error("{0}")]
8    Infallible(#[from] std::convert::Infallible),
9    /// Invalid content.
10    #[error("{0}")]
11    Invalid(String),
12    /// Item not found.
13    #[error("{0}")]
14    NotFound(String),
15    /// Utf8 parsing error.
16    #[error("{0}")]
17    Utf8Error(#[from] std::str::Utf8Error),
18    /// The given string to the Ecc is invalid.
19    #[error("{0}")]
20    InvalidEcc(String),
21    /// A child table has an invalid data source.
22    #[error("{0}")]
23    InvalidTableData(String),
24    /// Structural error when building an rcff container.
25    /// Metadata is only allowed once on each table within the container.
26    #[error("{0}")]
27    DuplicateMetadata(String),
28    /// File manipulation error.
29    #[error("{0}")]
30    StripPrefixError(#[from] std::path::StripPrefixError),
31    /// An IO error.
32    #[error("{0}")]
33    IoError(#[from] std::io::Error),
34}
35
36/// The standard result type used in the crate.
37pub type Result<T> = std::result::Result<T, crate::Error>;