use num_derive::FromPrimitive;
use solana_program::program_error::ProgramError;
use thiserror::Error;
#[derive(Clone, Debug, Eq, Error, FromPrimitive, PartialEq)]
pub enum PythError {
#[error("Failed to convert account into a Pyth account")]
InvalidAccountData,
#[error("Incorrect version number for Pyth account")]
BadVersionNumber,
#[error("Incorrect account type")]
WrongAccountType,
}
impl From<PythError> for ProgramError {
fn from(e: PythError) -> Self {
ProgramError::Custom(e as u32)
}
}