token_acl_interface/
error.rs1use num_traits::FromPrimitive;
2use solana_program_error::ProgramError;
3use spl_tlv_account_resolution::error::AccountResolutionError;
4
5#[derive(Clone, Debug, PartialEq, thiserror::Error)]
6pub enum ThawFreezeGateError {
7 IncorrectAccount,
10
11 MissingAccountMeta,
13
14 MissingExtraAccountMeta,
16
17 ResolutionError(spl_tlv_account_resolution::error::AccountResolutionError),
19
20 ProgramError(ProgramError),
21
22 InvalidTokenMint,
23}
24
25impl std::fmt::Display for ThawFreezeGateError {
26 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
27 write!(f, "{:?}", self)
28 }
29}
30
31impl Into<ThawFreezeGateError> for AccountResolutionError {
32 fn into(self) -> ThawFreezeGateError {
33 ThawFreezeGateError::ResolutionError(self)
34 }
35}
36
37impl Into<ThawFreezeGateError> for ProgramError {
38 fn into(self) -> ThawFreezeGateError {
39 match self {
40 ProgramError::Custom(code) => ThawFreezeGateError::ResolutionError(
41 AccountResolutionError::from_u32(code).unwrap(),
42 ),
43 _ => ThawFreezeGateError::ProgramError(self),
44 }
45 }
46}