solana_address_lookup_table_interface/
error.rs

1use core::fmt;
2
3#[derive(Debug, PartialEq, Eq, Clone)]
4pub enum AddressLookupError {
5    /// Attempted to lookup addresses from a table that does not exist
6    LookupTableAccountNotFound,
7
8    /// Attempted to lookup addresses from an account owned by the wrong program
9    InvalidAccountOwner,
10
11    /// Attempted to lookup addresses from an invalid account
12    InvalidAccountData,
13
14    /// Address lookup contains an invalid index
15    InvalidLookupIndex,
16}
17
18impl std::error::Error for AddressLookupError {}
19
20impl fmt::Display for AddressLookupError {
21    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> fmt::Result {
22        f.write_str(match self {
23            Self::LookupTableAccountNotFound => {
24                "Attempted to lookup addresses from a table that does not exist"
25            }
26            Self::InvalidAccountOwner => {
27                "Attempted to lookup addresses from an account owned by the wrong program"
28            }
29            Self::InvalidAccountData => "Attempted to lookup addresses from an invalid account",
30            Self::InvalidLookupIndex => "Address lookup contains an invalid index",
31        })
32    }
33}