forked from regolith-labs/ore
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy patherror.rs
34 lines (32 loc) · 1.04 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
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 CoalError {
#[error("The epoch has ended and needs reset")]
NeedsReset = 0,
#[error("The provided hash is invalid")]
HashInvalid = 1,
#[error("The provided hash did not satisfy the minimum required difficulty")]
HashTooEasy = 2,
#[error("The claim amount cannot be greater than the claimable rewards")]
ClaimTooLarge = 3,
#[error("The clock time is invalid")]
ClockInvalid = 4,
#[error("You are trying to submit too soon")]
Spam = 5,
#[error("The maximum supply has been reached")]
MaxSupply = 6,
#[error("The proof does not match the expected account")]
AuthFailed = 7,
#[error("Slot too early")]
SlotTooEarly = 8,
#[error("The resource is invalid")]
InvalidResource = 9,
}
impl From<CoalError> for ProgramError {
fn from(e: CoalError) -> Self {
ProgramError::Custom(e as u32)
}
}