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 TransportError to transaction-error crate
- Loading branch information
1 parent
ec21ccc
commit 70b4a8a
Showing
2 changed files
with
64 additions
and
25 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,4 @@ | ||
//! Defines the [`TransportError`] type. | ||
#![cfg(feature = "full")] | ||
|
||
use {solana_transaction_error::TransactionError, std::io, thiserror::Error}; | ||
|
||
#[derive(Debug, Error)] | ||
pub enum TransportError { | ||
#[error("transport io error: {0}")] | ||
IoError(#[from] io::Error), | ||
#[error("transport transaction error: {0}")] | ||
TransactionError(#[from] TransactionError), | ||
#[error("transport custom error: {0}")] | ||
Custom(String), | ||
} | ||
|
||
impl TransportError { | ||
pub fn unwrap(&self) -> TransactionError { | ||
if let TransportError::TransactionError(err) = self { | ||
err.clone() | ||
} else { | ||
panic!("unexpected transport error") | ||
} | ||
} | ||
} | ||
|
||
pub type Result<T> = std::result::Result<T, TransportError>; | ||
pub use solana_transaction_error::{TransportError, TransportResult as Result}; |
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