psarc2 0.1.0

PlayStation archive reader
Documentation
//! Error handling.

use std::path::PathBuf;

/// Simplify return types.
pub(crate) type Result<T> = std::result::Result<T, Error>;

/// Any error that can be returned from reading the archive.
#[allow(clippy::missing_docs_in_private_items)]
#[derive(Debug, thiserror::Error)]
#[non_exhaustive]
pub enum Error {
    #[error("file is not a PlayStation Archive file")]
    UnrecognizedFile,
    #[error("unsupported version")]
    UnsupportedVersion,
    #[error("unsupported compression method")]
    UnsupportedCompression(String),
    #[error(
        "table of contents needs decrypting but decryption key field in read configuration is not set"
    )]
    MissingDecryptionKey,
    #[error("corrupt file, reason: {0}")]
    Corrupt(&'static str),
    #[error("file at index {0} does not exist")]
    FileAtIndexDoesNotExist(usize),
    #[error("file at path {0} does not exist")]
    FileAtPathDoesNotExist(PathBuf),
    #[error("could not read from file: {0}")]
    Read(#[from] std::io::Error),
    #[error("system with less than 32 bits can't parse files")]
    AddressTooSmall,
}