spl_token_group_interface/
error.rs1use solana_program_error::{ProgramError, ToStr};
4
5#[repr(u32)]
7#[derive(
8 Clone,
9 Debug,
10 Eq,
11 thiserror::Error,
12 num_derive::FromPrimitive,
13 num_enum::TryFromPrimitive,
14 PartialEq,
15)]
16pub enum TokenGroupError {
17 #[error("Size is greater than proposed max size")]
19 SizeExceedsNewMaxSize = 3_406_457_176,
20 #[error("Size is greater than max size")]
22 SizeExceedsMaxSize,
23 #[error("Group is immutable")]
25 ImmutableGroup,
26 #[error("Incorrect mint authority has signed the instruction")]
28 IncorrectMintAuthority,
29 #[error("Incorrect update authority has signed the instruction")]
31 IncorrectUpdateAuthority,
32 #[error("Member account should not be the same as the group account")]
34 MemberAccountIsGroupAccount,
35}
36
37impl From<TokenGroupError> for ProgramError {
38 fn from(e: TokenGroupError) -> Self {
39 ProgramError::Custom(e as u32)
40 }
41}
42
43impl ToStr for TokenGroupError {
44 fn to_str(&self) -> &'static str {
45 match self {
46 TokenGroupError::SizeExceedsNewMaxSize => "Size is greater than proposed max size",
47 TokenGroupError::SizeExceedsMaxSize => "Size is greater than max size",
48 TokenGroupError::ImmutableGroup => "Group is immutable",
49 TokenGroupError::IncorrectMintAuthority => {
50 "Incorrect mint authority has signed the instruction"
51 }
52 TokenGroupError::IncorrectUpdateAuthority => {
53 "Incorrect update authority has signed the instruction"
54 }
55 TokenGroupError::MemberAccountIsGroupAccount => {
56 "Member account should not be the same as the group account"
57 }
58 }
59 }
60}