1use std::sync::Arc;
4
5#[derive(Clone, Debug, thiserror::Error)]
7#[non_exhaustive]
8pub enum Error {
9 #[error("HashX program can't be constructed for this specific seed")]
12 ProgramConstraints,
13
14 #[error("HashX compiler failed and no fallback was enabled: {0}")]
16 Compiler(#[from] CompilerError),
17}
18
19#[derive(Clone, Debug, thiserror::Error)]
21#[non_exhaustive]
22pub enum CompilerError {
23 #[error("There is no HashX compiler implementation available in this configuration")]
25 NotAvailable,
26
27 #[error("Runtime error while preparing the hash program: {0}")]
29 Runtime(#[source] Arc<std::io::Error>),
30}
31
32impl From<std::io::Error> for CompilerError {
33 fn from(err: std::io::Error) -> Self {
34 Self::Runtime(Arc::new(err))
35 }
36}