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
use anchor_lang::prelude::*;
#[error_code]
pub enum ErrorCode {
#[msg("Unexpected account has been used")]
UnexpectedAccount,
#[msg("Account is not authorized to perform this action")]
Unauthorized,
#[msg("Non-sequential case ID")]
NonSequentialCaseId,
#[msg("Release epoch is in future")]
ReleaseEpochInFuture,
#[msg("Invalid mint account")]
InvalidMint,
#[msg("Invalid reporter account")]
InvalidReporter,
#[msg("Reporter account is not active")]
InactiveReporter,
#[msg("Invalid token account")]
InvalidToken,
#[msg("Case closed")]
CaseClosed,
#[msg("Invalid reporter status")]
InvalidReporterStatus,
#[msg("Authority mismatched")]
AuthorityMismatch,
#[msg("Community mismatched")]
CommunityMismatch,
#[msg("This reporter is frozen")]
FrozenReporter,
#[msg("Risk score must be in 0..10 range")]
RiskOutOfRange,
#[msg("Network mismatched")]
NetworkMismatch,
#[msg("Case mismatched")]
CaseMismatch,
#[msg("Same address case")]
SameCase,
#[msg("There is no reward to claim")]
NoReward,
#[msg("Account has illegal owner")]
IllegalOwner,
#[msg("User account has high risk")]
HighAccountRisk,
}
pub fn print_error(error: ErrorCode) -> Result<()> {
msg!("Error: {}", error);
Err(error.into())
}