1#![cfg(feature = "full")]
2
3use {crate::transaction::TransactionError, std::io, thiserror::Error};
4
5#[derive(Debug, Error)]
6pub enum TransportError {
7 #[error("transport io error: {0}")]
8 IoError(#[from] io::Error),
9 #[error("transport transaction error: {0}")]
10 TransactionError(#[from] TransactionError),
11 #[error("transport custom error: {0}")]
12 Custom(String),
13}
14
15impl TransportError {
16 pub fn unwrap(&self) -> TransactionError {
17 if let TransportError::TransactionError(err) = self {
18 err.clone()
19 } else {
20 panic!("unexpected transport error")
21 }
22 }
23}
24
25pub type Result<T> = std::result::Result<T, TransportError>;