1use num_derive::FromPrimitive;
2use solana_program::program_error::ProgramError;
3use thiserror::Error;
4
5#[derive(Clone, Debug, Eq, Error, FromPrimitive, PartialEq)]
7pub enum PythError {
8 #[error("Failed to convert account into a Pyth account")]
11 InvalidAccountData,
12 #[error("Incorrect version number for Pyth account")]
14 BadVersionNumber,
15 #[error("Incorrect account type")]
18 WrongAccountType,
19}
20
21impl From<PythError> for ProgramError {
22 fn from(e: PythError) -> Self {
23 ProgramError::Custom(e as u32)
24 }
25}