Skip to content

Commit 042a055

Browse files
committed
add LidoError
1 parent 17884bd commit 042a055

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

core/src/err.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
use core::{error::Error, fmt::Display};
2+
3+
/// NB: this is not in the order defined by the program
4+
/// TODO: `seqconsts!()` this to make it so
5+
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
6+
pub enum LidoError {
7+
CalculationFailure,
8+
ExchangeRateNotUpdatedInThisEpoch,
9+
InvalidAmount,
10+
ValidatorWithMoreStakeExists,
11+
}
12+
13+
impl Display for LidoError {
14+
// Display=Debug, since this is just a simple str enum
15+
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
16+
write!(f, "{self:?}")
17+
}
18+
}
19+
20+
impl Error for LidoError {}

core/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#![cfg_attr(not(test), no_std)]
22

3+
mod err;
34
mod instructions;
45
mod internal_utils;
56
mod keys;
@@ -8,6 +9,7 @@ mod quote;
89
mod state;
910
mod typedefs;
1011

12+
pub use err::*;
1113
pub use instructions::*;
1214
pub use keys::*;
1315
pub use pda::*;

0 commit comments

Comments
 (0)