cbe_program/
scoobies.rs

1//! Defines the [`ScoobiesError`] type.
2
3use {crate::instruction::InstructionError, thiserror::Error};
4
5#[derive(Debug, Error)]
6pub enum ScoobiesError {
7    /// arithmetic underflowed
8    #[error("Arithmetic underflowed")]
9    ArithmeticUnderflow,
10
11    /// arithmetic overflowed
12    #[error("Arithmetic overflowed")]
13    ArithmeticOverflow,
14}
15
16impl From<ScoobiesError> for InstructionError {
17    fn from(error: ScoobiesError) -> Self {
18        match error {
19            ScoobiesError::ArithmeticOverflow => InstructionError::ArithmeticOverflow,
20            ScoobiesError::ArithmeticUnderflow => InstructionError::ArithmeticOverflow,
21        }
22    }
23}