use std::io;

#[derive(Debug, thiserror::Error)]
pub enum Error {
    #[error("{0}")]
    Io(#[from] io::Error),
    #[error("ELF parse error: {0}")]
    ElfParse(#[from] elf::ParseError),
    #[error("Memory mapping error: {0:?}")]
    MemoryMap(yggdrasil_rt::Error),
    #[error("Unsupported object data")]
    UnhandledObject,
    #[error("Object not loaded yet")]
    NotLoaded,
    #[error("Unsupported ELF type: {0:#06x}")]
    UnhandledElfType(u16),
    #[error("Unresolved symbols")]
    UnresolvedSymbols,
    #[error("Library not found: {0:?}")]
    LibraryNotFound(String),
    #[error("Object does not have an entry (trying to run a shared library?)")]
    NoEntrypoint,
    #[error("Configuration error")]
    ConfigError(toml::de::Error),
}
