-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy patherror.rs
42 lines (40 loc) · 1.54 KB
/
error.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
use num_enum::IntoPrimitive;
use solana_program::program_error::ProgramError;
use thiserror::Error;
#[derive(Debug, Error, Clone, Copy, PartialEq, Eq, IntoPrimitive)]
#[repr(u32)]
pub enum DlpError {
#[error("Invalid Authority")]
InvalidAuthority = 0,
#[error("Account cannot be undelegated, is_undelegatable is false")]
NotUndelegatable = 1,
#[error("Unauthorized Operation")]
Unauthorized = 2,
#[error("Invalid Authority for the current target program")]
InvalidAuthorityForProgram = 3,
#[error("Delegated account does not match the expected account")]
InvalidDelegatedAccount = 4,
#[error("Delegated account is not in a valid state")]
InvalidDelegatedState = 5,
#[error("Reimbursement account does not match the expected account")]
InvalidReimbursementAccount = 6,
#[error("Invalid account data after CPI")]
InvalidAccountDataAfterCPI = 7,
#[error("Invalid validator balance after CPI")]
InvalidValidatorBalanceAfterCPI = 8,
#[error("Invalid reimbursement address for delegation rent")]
InvalidReimbursementAddressForDelegationRent = 9,
#[error("Authority is invalid for the delegated account program owner")]
InvalidWhitelistProgramConfig = 10,
#[error("Account already undelegated")]
AlreadyUndelegated = 11,
#[error("Committed state slot is outdated")]
OutdatedSlot = 12,
#[error("Computation overflow detected")]
Overflow = 13,
}
impl From<DlpError> for ProgramError {
fn from(e: DlpError) -> Self {
ProgramError::Custom(e as u32)
}
}