caco 0.5.33

library for dealing with doom [et al] wad files
Documentation
//! Error type(s) specific to this crate, for use within the other functions this crate

use std::fmt::Display;

/// An error originating directly within [`caco`](crate). This is only used when an exception is
/// met that does not already result in an existing error - library calls that return errors
/// will have their errors propogated up unaltered.
#[derive(Clone, Copy, Debug)]
pub enum Error {
    /// A file was parsed as a certain format, but the file did not contain that format's identifier
    /// where it should have been.
    /// 
    /// For example, a file was loaded as a Doom wad but did not start with the ASCII
    /// sequence 'IWAD' or 'PWAD'.
    IncorrectMagicInHeader,

    /// Error parsing a clump as a specific format, or from trying to encode incorrectly formatted
    /// data into a clump...
    /// 
    /// should more descriptive!!!!!!!! / more variants
    FormatError,
}

impl Display for Error {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        write!(f, "not a wad of the specified format, or the header magic is incorrect")
    }
}

impl std::error::Error for Error {}