solana_program/
lamports.rs

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