bitoku_sdk_agent_native/
error.rs

1use thiserror::Error;
2
3use solana_program::{decode_error::DecodeError, program_error::ProgramError};
4
5#[derive(Error, Clone, Debug, Eq, PartialEq)]
6pub enum BitokuError {
7    #[error("Instruction is not valid")]
8    InvalidInstruction,
9
10    #[error("client limit reached")]
11    NoAvailableClients,
12
13    #[error("numbers overflow")]
14    Overflow,
15
16    #[error("client is not registered")]
17    UnregisteredClient,
18
19    #[error("name is not valid")]
20    InvalidName,
21}
22
23impl From<BitokuError> for ProgramError {
24    fn from(e: BitokuError) -> Self {
25        ProgramError::Custom(e as u32)
26    }
27}
28
29impl<T> DecodeError<T> for BitokuError {
30    fn type_of() -> &'static str {
31        "BitokuError"
32    }
33}