ghostscope_dwarf/core/
errors.rs

1//! Error types for the DWARF analysis library
2
3use std::path::PathBuf;
4
5/// Error types for the library
6#[derive(thiserror::Error, Debug)]
7pub enum DwarfError {
8    #[error("IO error: {0}")]
9    Io(#[from] std::io::Error),
10    #[error("DWARF parsing error: {0}")]
11    Gimli(#[from] gimli::Error),
12    #[error("Object file error: {0}")]
13    Object(#[from] object::Error),
14    #[error("Module not found: {path}")]
15    ModuleNotFound { path: PathBuf },
16    #[error("Process not found: {pid}")]
17    ProcessNotFound { pid: u32 },
18    #[error("Module load error: {0}")]
19    ModuleLoadError(String),
20    #[error("Invalid DWARF data")]
21    InvalidDwarf,
22}
23
24/// Result type used throughout the library
25pub type Result<T> = anyhow::Result<T>;