-
Notifications
You must be signed in to change notification settings - Fork 59
/
Copy patherror.rs
33 lines (27 loc) · 1.12 KB
/
error.rs
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
use core::fmt;
#[derive(Debug, PartialEq, Eq, Clone)]
pub enum AddressLookupError {
/// Attempted to lookup addresses from a table that does not exist
LookupTableAccountNotFound,
/// Attempted to lookup addresses from an account owned by the wrong program
InvalidAccountOwner,
/// Attempted to lookup addresses from an invalid account
InvalidAccountData,
/// Address lookup contains an invalid index
InvalidLookupIndex,
}
impl core::error::Error for AddressLookupError {}
impl fmt::Display for AddressLookupError {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> fmt::Result {
f.write_str(match self {
Self::LookupTableAccountNotFound => {
"Attempted to lookup addresses from a table that does not exist"
}
Self::InvalidAccountOwner => {
"Attempted to lookup addresses from an account owned by the wrong program"
}
Self::InvalidAccountData => "Attempted to lookup addresses from an invalid account",
Self::InvalidLookupIndex => "Address lookup contains an invalid index",
})
}
}