Skip to main content

antegen_thread_program/
errors.rs

1//! Errors thrown by the program.
2
3use anchor_lang::prelude::*;
4
5/// Errors for the the Antegen thread program.
6#[error_code]
7pub enum AntegenThreadError {
8    /// Thrown if a exec response has an invalid program ID or cannot be parsed.
9    #[msg("The exec response could not be parsed")]
10    InvalidThreadResponse,
11
12    /// Thrown if a thread has an invalid state and cannot complete the operation.
13    #[msg("The thread is in an invalid state")]
14    InvalidThreadState,
15
16    /// The provided trigger variant is invalid.
17    #[msg("The trigger variant cannot be changed")]
18    InvalidTriggerVariant,
19
20    /// The provided nonce account is invalid.
21    #[msg("The provided nonce account is invalid")]
22    InvalidNonceAccount,
23
24    /// Thrown if a exec instruction is invalid because the thread's trigger condition has not been met.
25    #[msg("The trigger condition has not been activated")]
26    TriggerConditionFailed,
27
28    #[msg("This operation cannot be processed because the thread is currently busy")]
29    ThreadBusy,
30
31    /// Thrown if a request is invalid because the thread is currently paused.
32    #[msg("The thread is currently paused")]
33    ThreadPaused,
34
35    /// Thrown if a exec instruction would cause a thread to exceed its rate limit.
36    #[msg("The thread's rate limit has been reached")]
37    RateLimitExeceeded,
38
39    /// Thrown if a thread authority attempts to set a rate limit above the maximum allowed value.
40    #[msg("Thread rate limits cannot exceed the maximum allowed value")]
41    MaxRateLimitExceeded,
42
43    /// Thrown if an inner instruction attempted to write to an unauthorized address.
44    #[msg("Inner instruction attempted to write to an unauthorized address")]
45    UnauthorizedWrite,
46
47    /// Thrown if the user attempts to withdraw SOL that would put a thread below it's minimum rent threshold.
48    #[msg("Withdrawing this amount would leave the thread with less than the minimum required SOL for rent exemption")]
49    WithdrawalTooLarge,
50
51    #[msg("Thread IDs are limited to 32 bytes")]
52    ThreadIdTooLong,
53
54    #[msg("InsufficientFunds")]
55    InsufficientFunds,
56
57    #[msg("MathOverflow")]
58    MathOverflow,
59
60    #[msg("Thread does not have a nonce account")]
61    ThreadHasNoNonceAccount,
62
63    #[msg("Thread is currently being observed by observers")]
64    ThreadBeingObserved,
65
66    #[msg("Observer has not claimed this thread")]
67    ObserverNotClaimed,
68
69    #[msg("Invalid thread authority")]
70    InvalidThreadAuthority,
71
72    #[msg("Invalid observer authority")]
73    InvalidObserverAuthority,
74
75    #[msg("Invalid registry admin")]
76    InvalidRegistryAdmin,
77
78    #[msg("Invalid instruction provided to thread_submit")]
79    InvalidInstruction,
80
81    #[msg("Invalid signatory for observer")]
82    InvalidSignatory,
83
84    #[msg("This instruction must be called via CPI")]
85    MustBeCalledViaCPI,
86    
87    #[msg("Fiber already claimed by another observer")]
88    AlreadyClaimed,
89    
90    #[msg("Wrong fiber index for current execution")]
91    WrongFiberIndex,
92    
93    #[msg("Observer priority window is still active")]
94    ObserverPriorityActive,
95    
96    #[msg("Trigger is not ready yet")]
97    TriggerNotReady,
98    
99    #[msg("Nonce account is required for all threads")]
100    NonceRequired,
101    
102    #[msg("Invalid observer account provided")]
103    InvalidObserverAccount,
104    
105    #[msg("Invalid config admin")]
106    InvalidConfigAdmin,
107    
108    #[msg("Global pause is active")]
109    GlobalPauseActive,
110    
111    #[msg("Invalid authority for this operation")]
112    InvalidAuthority,
113    
114    #[msg("Invalid fee percentage (must be 0-10000)")]
115    InvalidFeePercentage,
116    
117    #[msg("Initial instruction provided but fiber account is missing")]
118    MissingFiberAccount,
119
120    #[msg("Invalid fiber index specified in ThreadResponse")]
121    InvalidFiberIndex,
122
123    #[msg("Thread has fibers that must be deleted before the thread can be deleted")]
124    ThreadHasFibers,
125
126    #[msg("Thread has no fibers to execute")]
127    ThreadHasNoFibersToExecute,
128
129    #[msg("Invalid execution index - fiber not found in thread")]
130    InvalidExecIndex,
131
132    #[msg("Only the last executor or no executor can report errors")]
133    NotLastExecutor,
134
135    #[msg("An error has already been reported for this thread")]
136    ErrorAlreadyReported,
137
138    #[msg("Thread is not sufficiently overdue to report an error")]
139    ThreadNotSufficientlyOverdue,
140
141    #[msg("Payment distribution failed")]
142    PaymentFailed,
143
144    #[msg("Fiber account is required for this execution")]
145    FiberAccountRequired,
146
147    #[msg("Invalid fiber cursor provided")]
148    InvalidFiberCursor,
149
150    #[msg("Invalid fiber account - does not belong to this thread or not in fiber_ids")]
151    InvalidFiberAccount,
152
153    #[msg("Missing fiber accounts - all external fibers must be provided for deletion")]
154    MissingFiberAccounts,
155
156    #[msg("Thread has not signaled close - fiber_signal must be Signal::Close")]
157    CloseNotSignaled,
158
159    #[msg("Chain signal must target the next consecutive fiber")]
160    InvalidChainTarget,
161}
162
163/// Alias for AntegenThreadError
164pub use AntegenThreadError as ThreadError;