1use num_derive::FromPrimitive;
4use solana_program::{decode_error::DecodeError, program_error::ProgramError};
5use thiserror::Error;
6
7#[derive(Clone, Debug, Eq, Error, FromPrimitive, PartialEq)]
9pub enum RecordError {
10 #[error("Incorrect authority provided on update or delete")]
12 IncorrectAuthority,
13
14 #[error("Calculation overflow")]
16 Overflow,
17}
18impl From<RecordError> for ProgramError {
19 fn from(e: RecordError) -> Self {
20 ProgramError::Custom(e as u32)
21 }
22}
23impl<T> DecodeError<T> for RecordError {
24 fn type_of() -> &'static str {
25 "Record Error"
26 }
27}