1
#[cfg(feature = "on-chain")]
2
use solana_program::program_error::ProgramError;
3

            
4
#[cfg(not(feature = "on-chain"))]
5
use solana_sdk::program_error::ProgramError;
6

            
7
#[derive(thiserror::Error, Debug)]
8
pub enum ClientError {
9
    #[error("InvalidInput")]
10
    InvalidInput,
11
    #[error("InvalidCallbackExtraAccounts")]
12
    InvalidCallbackExtraAccounts,
13
    #[error("InvalidCallbackProgram")]
14
    InvalidCallbackProgram,
15
    #[error("InvalidInstructionAccounts")]
16
    InvalidCallbackInstructionAccounts,
17
    #[error("InvalidCallbackSignature")]
18
    InvalidCallbackSignature,
19
    #[error("InvalidCallbackData")]
20
    InvalidCallbackData,
21
    #[error("InvalidClaimAccount")]
22
    InvalidClaimAccount,
23
    #[error("InvalidCallbackImageId")]
24
    InvalidCallbackImageId,
25
    #[error("Execution Request Reused")]
26
    ExecutionRequestReused,
27
}
28

            
29
impl From<ClientError> for ProgramError {
30
    fn from(val: ClientError) -> Self {
31
        ProgramError::Custom(val as u32)
32
    }
33
}