use osiris_data::memory::{MemoryError, MemoryResult};
use crate::operation::Instruction;
use crate::operation::scheme::ArgumentType;
#[derive(Debug)]
pub enum OperationError {
HaltError,
Panic(String),
InvalidArgumentType { expected: ArgumentType, provided: ArgumentType },
MemoryError(MemoryError),
CannotReturnFromEmptyStack,
MismatchedInstruction(Instruction),
}
pub type OperationResult<T> = Result<T, OperationError>;
pub fn promote<T>(memory_result: MemoryResult<T>) -> OperationResult<T> {
match memory_result {
Ok(ok_value) => Ok(ok_value),
Err(e) => Err(OperationError::MemoryError(e))
}
}