gemachain_program/
carats.rs

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