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