userdmp 0.1.4

A library in Rust for parsing Minidump (.dmp) files generated in user mode on Windows
Documentation
//! The module defines error types used throughout the library.

use binrw::Error as BinrwError;
use thiserror::Error;

/// Represents errors that may occur during the processing of a minidump file.
#[derive(Debug, Error)]
pub enum UserDmpError {
    /// Raised when the application fails to open a file.
    #[error("Failed to open file: {0}")]
    FileOpenError(#[from] std::io::Error),

    /// Raised when the minidump contains an invalid signature.
    #[error("Invalid minidump signature.")]
    InvalidSignature,

    /// Raised when the minidump contains invalid or unsupported flags.
    #[error("The minidump contains invalid or unsupported flags: {0:#x}")]
    InvalidFlags(u64),

    /// Raised when the minidump specifies an unsupported architecture.
    #[error("Unsupported architecture: {0}")]
    UnsupportedArchitecture(u16),

    /// Raised when the application fails to parse the system information in the minidump.
    #[error("Failed to parse system info: {0}")]
    ParseSystemInfoError(std::io::Error),

    /// Raised when the application fails to parse the module list in the minidump.
    #[error("Failed to parse module list: {0}")]
    ParseModuleListError(std::io::Error),

    /// Raised when the minidump contains a module with an invalid memory range.
    #[error("Invalid memory range in module.")]
    InvalidMemoryRange,

    /// Raised when the application fails to create a file mapping for the minidump.
    #[error("Failed to create file mapping.")]
    CreateFileMappingError,

    /// Raised when the application fails to map a view of the minidump file (Windows).
    #[error("Failed to map view of file.")]
    MapViewOfFileError,

    /// Raised when the application fails to map a view of the minidump file (Unix).
    #[error("Failed to map view of file.")]
    MmapError,

    /// Raised when a parsing error occurs in the `binrw` library.
    #[error("Parsing error: {0}")]
    BinrwError(#[from] BinrwError),

    /// Raised when an address cannot be found in the `Memory64ListStream`.
    #[error("Address {0:#x?} was not found in Memory64ListStream")]
    AddressNotFound(u64),

    /// Raised when the context is invalid.
    #[error("Invalid context")]
    InvalidContext,
}