hapi_core/
error.rs

1use anchor_lang::prelude::*;
2
3#[error_code]
4pub enum ErrorCode {
5    #[msg("Unexpected account has been used")]
6    UnexpectedAccount,
7    #[msg("Account is not authorized to perform this action")]
8    Unauthorized,
9    #[msg("Non-sequential case ID")]
10    NonSequentialCaseId,
11    #[msg("Release epoch is in future")]
12    ReleaseEpochInFuture,
13    #[msg("Invalid mint account")]
14    InvalidMint,
15    #[msg("Invalid reporter account")]
16    InvalidReporter,
17    #[msg("Reporter account is not active")]
18    InactiveReporter,
19    #[msg("Invalid token account")]
20    InvalidToken,
21    #[msg("Case closed")]
22    CaseClosed,
23    #[msg("Invalid reporter status")]
24    InvalidReporterStatus,
25    #[msg("Authority mismatched")]
26    AuthorityMismatch,
27    #[msg("Community mismatched")]
28    CommunityMismatch,
29    #[msg("This reporter is frozen")]
30    FrozenReporter,
31    #[msg("Risk score must be in 0..10 range")]
32    RiskOutOfRange,
33    #[msg("Network mismatched")]
34    NetworkMismatch,
35    #[msg("Case mismatched")]
36    CaseMismatch,
37    #[msg("Same address case")]
38    SameCase,
39    #[msg("There is no reward to claim")]
40    NoReward,
41    #[msg("Account has illegal owner")]
42    IllegalOwner,
43    #[msg("User account has high risk")]
44    HighAccountRisk,
45}
46
47pub fn print_error(error: ErrorCode) -> Result<()> {
48    msg!("Error: {}", error);
49    Err(error.into())
50}