use std::sync::Arc;
#[derive(Clone, Debug, thiserror::Error)]
#[non_exhaustive]
pub enum Error {
#[error("HashX program can't be constructed for this specific seed")]
ProgramConstraints,
#[error("HashX compiler failed and no fallback was enabled: {0}")]
Compiler(#[from] CompilerError),
}
#[derive(Clone, Debug, thiserror::Error)]
#[non_exhaustive]
pub enum CompilerError {
#[error("There is no HashX compiler implementation available in this configuration")]
NotAvailable,
#[error("Runtime error while preparing the hash program: {0}")]
Runtime(#[source] Arc<std::io::Error>),
}
impl From<std::io::Error> for CompilerError {
fn from(err: std::io::Error) -> Self {
Self::Runtime(Arc::new(err))
}
}