solana_address_lookup_table_program/
error.rs

1#[cfg(not(target_os = "solana"))]
2use solana_program::message::AddressLoaderError;
3use thiserror::Error;
4
5#[derive(Debug, Error, PartialEq, Eq, Clone)]
6pub enum AddressLookupError {
7    /// Attempted to lookup addresses from a table that does not exist
8    #[error("Attempted to lookup addresses from a table that does not exist")]
9    LookupTableAccountNotFound,
10
11    /// Attempted to lookup addresses from an account owned by the wrong program
12    #[error("Attempted to lookup addresses from an account owned by the wrong program")]
13    InvalidAccountOwner,
14
15    /// Attempted to lookup addresses from an invalid account
16    #[error("Attempted to lookup addresses from an invalid account")]
17    InvalidAccountData,
18
19    /// Address lookup contains an invalid index
20    #[error("Address lookup contains an invalid index")]
21    InvalidLookupIndex,
22}
23
24#[cfg(not(target_os = "solana"))]
25impl From<AddressLookupError> for AddressLoaderError {
26    fn from(err: AddressLookupError) -> Self {
27        match err {
28            AddressLookupError::LookupTableAccountNotFound => Self::LookupTableAccountNotFound,
29            AddressLookupError::InvalidAccountOwner => Self::InvalidAccountOwner,
30            AddressLookupError::InvalidAccountData => Self::InvalidAccountData,
31            AddressLookupError::InvalidLookupIndex => Self::InvalidLookupIndex,
32        }
33    }
34}