forked from solana-labs/solana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add handling for fallible signers (solana-labs#8367)
automerge
- Loading branch information
1 parent
18fd523
commit 0b7e8d0
Showing
9 changed files
with
181 additions
and
83 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,50 +1,20 @@ | ||
use crate::rpc_request; | ||
use solana_sdk::transaction::TransactionError; | ||
use solana_sdk::{signature::SignerError, transaction::TransactionError}; | ||
use std::{fmt, io}; | ||
use thiserror::Error; | ||
|
||
#[derive(Debug)] | ||
#[derive(Error, Debug)] | ||
pub enum ClientError { | ||
Io(io::Error), | ||
Reqwest(reqwest::Error), | ||
RpcError(rpc_request::RpcError), | ||
SerdeJson(serde_json::error::Error), | ||
TransactionError(TransactionError), | ||
Io(#[from] io::Error), | ||
Reqwest(#[from] reqwest::Error), | ||
RpcError(#[from] rpc_request::RpcError), | ||
SerdeJson(#[from] serde_json::error::Error), | ||
SigningError(#[from] SignerError), | ||
TransactionError(#[from] TransactionError), | ||
} | ||
|
||
impl fmt::Display for ClientError { | ||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { | ||
write!(f, "solana client error") | ||
} | ||
} | ||
|
||
impl std::error::Error for ClientError {} | ||
|
||
impl From<io::Error> for ClientError { | ||
fn from(err: io::Error) -> ClientError { | ||
ClientError::Io(err) | ||
} | ||
} | ||
|
||
impl From<reqwest::Error> for ClientError { | ||
fn from(err: reqwest::Error) -> ClientError { | ||
ClientError::Reqwest(err) | ||
} | ||
} | ||
|
||
impl From<rpc_request::RpcError> for ClientError { | ||
fn from(err: rpc_request::RpcError) -> ClientError { | ||
ClientError::RpcError(err) | ||
} | ||
} | ||
|
||
impl From<serde_json::error::Error> for ClientError { | ||
fn from(err: serde_json::error::Error) -> ClientError { | ||
ClientError::SerdeJson(err) | ||
} | ||
} | ||
|
||
impl From<TransactionError> for ClientError { | ||
fn from(err: TransactionError) -> ClientError { | ||
ClientError::TransactionError(err) | ||
} | ||
} |
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
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
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
Oops, something went wrong.