use thiserror::Error as ThisError;
use crate::flags::RandomXFlags;
#[derive(ThisError, Debug, Clone)]
pub enum RandomXError {
#[error("cache allocation with flags {flags:?} failed")]
CacheAllocationFailed { flags: RandomXFlags },
#[error("dataset allocation with flags {flags:?} failed")]
DatasetAllocationError { flags: RandomXFlags },
#[error(transparent)]
VMCreationFailed(#[from] VmCreationError),
}
#[derive(ThisError, Debug, Clone)]
pub enum VmCreationError {
#[error("vm allocation with flags {flags:?} failed")]
AllocationFailed { flags: RandomXFlags },
#[error("to allocate vm in the fast mode, flags {flags:?} must contain the full mem option")]
IncorrectFastModeFlag { flags: RandomXFlags },
#[error(
"to allocate vm in the light mode, flags {flags:?} must no contain the full mem option"
)]
IncorrectLightModeFlag { flags: RandomXFlags },
}