sablier_thread_program/
errors.rs

1//! Errors thrown by the program.
2
3use anchor_lang::prelude::*;
4
5/// Errors for the the Sablier thread program.
6#[error_code]
7pub enum SablierError {
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    /// TThe provided trigger variant is invalid.
17    #[msg("The trigger variant cannot be changed")]
18    InvalidTriggerVariant,
19
20    /// Thrown if a exec instruction is invalid because the thread's trigger condition has not been met.
21    #[msg("The trigger condition has not been activated")]
22    TriggerConditionFailed,
23
24    #[msg("This operation cannot be processes because the thread is currently busy")]
25    ThreadBusy,
26
27    /// Thrown if a request is invalid because the thread is currently paused.
28    #[msg("The thread is currently paused")]
29    ThreadPaused,
30
31    /// Thrown if a exec instruction would cause a thread to exceed its rate limit.
32    #[msg("The thread's rate limit has been reached")]
33    RateLimitExeceeded,
34
35    /// Thrown if a thread authority attempts to set a rate limit above the maximum allowed value.
36    #[msg("Thread rate limits cannot exceed the maximum allowed value")]
37    MaxRateLimitExceeded,
38
39    /// Thrown if an inner instruction attempted to write to an unauthorized address.
40    #[msg("Inner instruction attempted to write to an unauthorized address")]
41    UnauthorizedWrite,
42
43    /// Thrown if the user attempts to withdraw SOL that would put a thread below it's minimum rent threshold.
44    #[msg("Withdrawing this amount would leave the thread with less than the minimum required SOL for rent exemption")]
45    WithdrawalTooLarge,
46
47    /// Thrown if the provided authority does not match the thread's authority.
48    #[msg("The provided authority does not match the thread's authority")]
49    InvalidThreadAuthority,
50
51    /// Thrown if the provided account is not a valid Thread account.
52    #[msg("The provided thread account is not a valid Thread account")]
53    InvalidThreadAccount,
54}