forked from magicblock-labs/delegation-program
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherror.rs
More file actions
56 lines (53 loc) · 1.99 KB
/
error.rs
File metadata and controls
56 lines (53 loc) · 1.99 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
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("Commit is out of order")]
NonceOutOfOrder = 12,
#[error("Computation overflow detected")]
Overflow = 13,
#[error("Too many seeds")]
TooManySeeds = 14,
#[error("Invalid length of diff passed to DiffSet::try_new")]
InvalidDiff = 15,
#[error("Diff is not properly aligned")]
InvalidDiffAlignment = 16,
#[error("MergeDiff precondition did not meet")]
MergeDiffError = 17,
}
impl From<DlpError> for ProgramError {
fn from(e: DlpError) -> Self {
ProgramError::Custom(e as u32)
}
}
impl From<DlpError> for pinocchio::program_error::ProgramError {
fn from(e: DlpError) -> Self {
pinocchio::program_error::ProgramError::Custom(e as u32)
}
}