pyth_solana_receiver_sdk/
error.rs

1use anchor_lang::error_code;
2
3#[error_code]
4#[derive(PartialEq)]
5pub enum GetPriceError {
6    #[msg("This price feed update's age exceeds the requested maximum age")]
7    PriceTooOld = 10000, // Big number to avoid conflicts with the SDK user's program error codes
8    #[msg("This TWAP update's window size is invalid")]
9    InvalidWindowSize,
10    #[msg("The price feed update doesn't match the requested feed id")]
11    MismatchedFeedId,
12    #[msg("This price feed update has a lower verification level than the one requested")]
13    InsufficientVerificationLevel,
14    #[msg("Feed id must be 32 Bytes, that's 64 hex characters or 66 with a 0x prefix")]
15    FeedIdMustBe32Bytes,
16    #[msg("Feed id contains non-hex characters")]
17    FeedIdNonHexCharacter,
18}
19
20#[macro_export]
21macro_rules! check {
22    ($cond:expr, $err:expr) => {
23        if !$cond {
24            return Err($err);
25        }
26    };
27}