Migrate to thiserror (#7177)
* Migrate to thiserror * Discourage the use of other modules' Result alias `io::Result` set a bad precedent. Don't import other `Result` aliases.
This commit is contained in:
@@ -17,6 +17,7 @@ num-traits = "0.2"
|
||||
serde = "1.0.103"
|
||||
serde_derive = "1.0.103"
|
||||
solana-sdk = { path = "../../sdk", version = "0.22.0" }
|
||||
thiserror = "1.0"
|
||||
|
||||
[dev-dependencies]
|
||||
solana-runtime = { path = "../../runtime", version = "0.22.0" }
|
||||
|
@@ -10,9 +10,11 @@ use solana_sdk::{
|
||||
pubkey::Pubkey,
|
||||
system_instruction,
|
||||
};
|
||||
use thiserror::Error;
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, FromPrimitive, ToPrimitive)]
|
||||
#[derive(Error, Debug, Clone, PartialEq, FromPrimitive, ToPrimitive)]
|
||||
pub enum BudgetError {
|
||||
#[error("destination missing")]
|
||||
DestinationMissing,
|
||||
}
|
||||
|
||||
@@ -22,19 +24,6 @@ impl<T> DecodeError<T> for BudgetError {
|
||||
}
|
||||
}
|
||||
|
||||
impl std::fmt::Display for BudgetError {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
write!(
|
||||
f,
|
||||
"{}",
|
||||
match self {
|
||||
BudgetError::DestinationMissing => "destination missing",
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
impl std::error::Error for BudgetError {}
|
||||
|
||||
/// An instruction to progress the smart contract.
|
||||
#[derive(Serialize, Deserialize, Debug, PartialEq, Eq, Clone)]
|
||||
pub enum BudgetInstruction {
|
||||
|
Reference in New Issue
Block a user