-
Notifications
You must be signed in to change notification settings - Fork 172
/
error.rs
28 lines (26 loc) · 947 Bytes
/
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
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 OreError {
#[error("The starting time has not passed yet")]
NotStarted = 0,
#[error("The epoch has ended and needs reset")]
NeedsReset = 1,
#[error("The epoch is active and cannot be reset at this time")]
ResetTooEarly = 2,
#[error("The provided hash was invalid")]
HashInvalid = 3,
#[error("The provided hash does not satisfy the difficulty requirement")]
DifficultyNotSatisfied = 4,
#[error("The bus does not have enough rewards to issue at this time")]
BusRewardsInsufficient = 5,
#[error("The claim amount cannot be greater than the claimable rewards")]
ClaimTooLarge = 6,
}
impl From<OreError> for ProgramError {
fn from(e: OreError) -> Self {
ProgramError::Custom(e as u32)
}
}