use num_derive::FromPrimitive;
use solana_program::{decode_error::DecodeError, program_error::ProgramError};
use thiserror::Error;
#[derive(Clone, Debug, Eq, Error, FromPrimitive, PartialEq)]
pub enum RecordError {
#[error("Incorrect authority provided on update or delete")]
IncorrectAuthority,
#[error("Calculation overflow")]
Overflow,
}
impl From<RecordError> for ProgramError {
fn from(e: RecordError) -> Self {
ProgramError::Custom(e as u32)
}
}
impl<T> DecodeError<T> for RecordError {
fn type_of() -> &'static str {
"Record Error"
}
}