-
Notifications
You must be signed in to change notification settings - Fork 110
/
Copy patherror.rs
67 lines (65 loc) · 2.33 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
//! Error types
use {
solana_program::program_error::ProgramError,
thiserror::Error,
};
/// Errors that may be returned by the oracle program
#[derive(Clone, Debug, Eq, Error, PartialEq)]
pub enum OracleError {
/// Generic catch all error
#[error("Generic")]
Generic = 600,
/// integer casting error
#[error("IntegerCastingError")]
IntegerCastingError = 601,
/// c_entrypoint returned an unexpected value
#[error("UnknownCError")]
UnknownCError = 602,
#[error("UnrecognizedInstruction")]
UnrecognizedInstruction = 603,
#[error("InvalidFundingAccount")]
InvalidFundingAccount = 604,
#[error("InvalidSignableAccount")]
InvalidSignableAccount = 605,
#[error("InvalidSystemAccount")]
InvalidSystemAccount = 606,
#[error("InvalidWritableAccount")]
InvalidWritableAccount = 607,
#[error("InvalidFreshAccount")]
InvalidFreshAccount = 608,
#[error("InvalidInstructionVersion")]
InvalidInstructionVersion = 609,
#[error("InstructionDataTooShort")]
InstructionDataTooShort = 610,
#[error("InstructionDataSliceMisaligned")]
InstructionDataSliceMisaligned = 611,
#[error("AccountTooSmall")]
AccountTooSmall = 612,
#[error("DeserializationError")]
DeserializationError = 613,
#[error("FailedAuthenticatingUpgradeAuthority")]
InvalidUpgradeAuthority = 614,
#[error("FailedPdaVerification")]
InvalidPda = 615,
#[error("InvalidAccountHeader")]
InvalidAccountHeader = 616,
#[error("InvalidNumberOfAccounts")]
InvalidNumberOfAccounts = 617,
#[error("InvalidReadableAccount")]
InvalidReadableAccount = 618,
#[error("PermissionViolation")]
PermissionViolation = 619,
#[error("NeedsSuccesfulAggregation")]
NeedsSuccesfulAggregation = 620,
#[error("MaxLastFeedIndexReached")]
MaxLastFeedIndexReached = 621,
#[error("FeedIndexAlreadyInitialized")]
FeedIndexAlreadyInitialized = 622,
#[error("NoNeedToResize")]
NoNeedToResize = 623,
}
impl From<OracleError> for ProgramError {
fn from(e: OracleError) -> Self {
ProgramError::Custom(e as u32)
}
}