Skip to main content

universalsettle_api/
error.rs

1use steel::*;
2
3#[derive(Debug, Error, Clone, Copy, PartialEq, Eq, IntoPrimitive)]
4#[repr(u32)]
5pub enum SettlementError {
6    #[error("Invalid token account")]
7    InvalidTokenAccount = 0,
8    #[error("Insufficient balance")]
9    InsufficientBalance = 1,
10    #[error("Fee calculation overflow")]
11    FeeOverflow = 2,
12    #[error("Invalid fee rate")]
13    InvalidFeeRate = 3,
14    #[error("Fee destination mismatch")]
15    FeeDestinationMismatch = 4,
16
17    // Authority Errors
18    #[error("The authority is invalid")]
19    InvalidAuthority = 5,
20    #[error("The authority is unchanged")]
21    AuthorityUnchanged = 6,
22    #[error("Only the authority can perform this action")]
23    Unauthorized = 7,
24
25    // Amount Validation Errors
26    #[error("Settlement amount is zero")]
27    InvalidAmount = 8,
28}
29
30error!(SettlementError);