This repository has been archived by the owner on Jan 13, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bump tarpc from 0.26.2 to 0.27.2 and add BanksClientError (#21739)
* chore: bump tarpc from 0.26.2 to 0.27.2 Bumps [tarpc](https://github.com/google/tarpc) from 0.26.2 to 0.27.2. - [Release notes](https://github.com/google/tarpc/releases) - [Changelog](https://github.com/google/tarpc/blob/master/RELEASES.md) - [Commits](https://github.com/google/tarpc/commits) --- updated-dependencies: - dependency-name: tarpc dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * [auto-commit] Update all Cargo lock files * Accommodate breaking changes * Reword incorrect error message * Add error module * Revert client Error type to io::Error; easy transition to BanksClientError * Bump tracing crates in programs Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: dependabot-buildkite <dependabot-buildkite@noreply.solana.com> Co-authored-by: Tyera Eulberg <tyera@solana.com>
- Loading branch information
1 parent
7cc6262
commit ddde356
Showing
8 changed files
with
155 additions
and
60 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,62 @@ | ||
use { | ||
solana_sdk::{transaction::TransactionError, transport::TransportError}, | ||
std::io, | ||
tarpc::client::RpcError, | ||
thiserror::Error, | ||
}; | ||
|
||
/// Errors from BanksClient | ||
#[derive(Error, Debug)] | ||
pub enum BanksClientError { | ||
#[error("client error: {0}")] | ||
ClientError(&'static str), | ||
|
||
#[error(transparent)] | ||
Io(#[from] io::Error), | ||
|
||
#[error(transparent)] | ||
RpcError(#[from] RpcError), | ||
|
||
#[error("transport transaction error: {0}")] | ||
TransactionError(#[from] TransactionError), | ||
} | ||
|
||
impl BanksClientError { | ||
pub fn unwrap(&self) -> TransactionError { | ||
if let BanksClientError::TransactionError(err) = self { | ||
err.clone() | ||
} else { | ||
panic!("unexpected transport error") | ||
} | ||
} | ||
} | ||
|
||
impl From<BanksClientError> for io::Error { | ||
fn from(err: BanksClientError) -> Self { | ||
match err { | ||
BanksClientError::ClientError(err) => Self::new(io::ErrorKind::Other, err.to_string()), | ||
BanksClientError::Io(err) => err, | ||
BanksClientError::RpcError(err) => Self::new(io::ErrorKind::Other, err.to_string()), | ||
BanksClientError::TransactionError(err) => { | ||
Self::new(io::ErrorKind::Other, err.to_string()) | ||
} | ||
} | ||
} | ||
} | ||
|
||
impl From<BanksClientError> for TransportError { | ||
fn from(err: BanksClientError) -> Self { | ||
match err { | ||
BanksClientError::ClientError(err) => { | ||
Self::IoError(io::Error::new(io::ErrorKind::Other, err.to_string())) | ||
} | ||
BanksClientError::Io(err) => { | ||
Self::IoError(io::Error::new(io::ErrorKind::Other, err.to_string())) | ||
} | ||
BanksClientError::RpcError(err) => { | ||
Self::IoError(io::Error::new(io::ErrorKind::Other, err.to_string())) | ||
} | ||
BanksClientError::TransactionError(err) => Self::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
Oops, something went wrong.