addr_symbolizer/
error.rs

1// Axel '0vercl0k' Souchet - May 27 2024
2use std::io;
3use std::num::{ParseIntError, TryFromIntError};
4use std::path::PathBuf;
5use std::str::Utf8Error;
6use std::string::FromUtf8Error;
7
8use pdb2::PdbInternalSectionOffset;
9use thiserror::Error;
10
11pub type Result<T> = std::result::Result<T, Error>;
12
13#[derive(Error, Debug)]
14pub enum Error {
15    #[error("failed to get rva from symbol {0} / {1:?}")]
16    SymbolRva(String, PdbInternalSectionOffset),
17    #[error("pdb error: {0}")]
18    Pdb(#[from] pdb2::Error),
19    #[error("from int error: {0}")]
20    FromInt(#[from] TryFromIntError),
21    #[error("parse int error: {0}")]
22    ParseInt(#[from] ParseIntError),
23    #[error("utf8: {0}")]
24    Utf8(#[from] Utf8Error),
25    #[error("from utf8: {0}")]
26    FromUtf8(#[from] FromUtf8Error),
27    #[error("pdb path {0:?} does not have a filename")]
28    PdbPathNoName(PathBuf),
29    #[error("failed to perform an i/o: {0}")]
30    Io(#[from] io::Error),
31    #[error("failed to download PE/PDB {entry_url}: {e}")]
32    Download {
33        entry_url: String,
34        e: Box<ureq::Error>,
35    },
36    #[error("the module path is either 0 or larger than reasonable")]
37    CodeViewInvalidPath,
38    #[error("{0}")]
39    Other(String),
40}