forked from solana-labs/solana
-
Notifications
You must be signed in to change notification settings - Fork 261
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move LamportsError to solana-instruction (#3081)
* move LamportsError to solana-instruction * nits
- Loading branch information
1 parent
74f6634
commit d663e05
Showing
2 changed files
with
35 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,6 @@ | ||
//! Defines the [`LamportsError`] type. | ||
use {crate::instruction::InstructionError, thiserror::Error}; | ||
|
||
#[derive(Debug, Error)] | ||
pub enum LamportsError { | ||
/// arithmetic underflowed | ||
#[error("Arithmetic underflowed")] | ||
ArithmeticUnderflow, | ||
|
||
/// arithmetic overflowed | ||
#[error("Arithmetic overflowed")] | ||
ArithmeticOverflow, | ||
} | ||
|
||
impl From<LamportsError> for InstructionError { | ||
fn from(error: LamportsError) -> Self { | ||
match error { | ||
LamportsError::ArithmeticOverflow => InstructionError::ArithmeticOverflow, | ||
LamportsError::ArithmeticUnderflow => InstructionError::ArithmeticOverflow, | ||
} | ||
} | ||
} | ||
//! Re-exports the [`LamportsError`] type for backwards compatibility. | ||
#[deprecated( | ||
since = "2.1.0", | ||
note = "Use solana_instruction::error::LamportsError instead" | ||
)] | ||
pub use solana_instruction::error::LamportsError; |