hopr_transport/
errors.rs

1use hopr_crypto_packet::errors::PacketError;
2pub use hopr_transport_network::errors::NetworkingError;
3pub use hopr_transport_probe::errors::ProbeError;
4pub use hopr_transport_protocol::errors::ProtocolError;
5use hopr_transport_session::errors::TransportSessionError;
6use thiserror::Error;
7
8/// Errors produced by the crate.
9#[derive(Error, Debug)]
10pub enum HoprTransportError {
11    #[error("API error: {0}")]
12    Api(String),
13
14    #[error("General error: {0}")]
15    General(#[from] hopr_primitive_types::errors::GeneralError),
16
17    #[error("Path error: {0}")]
18    Path(#[from] hopr_path::errors::PathError),
19
20    #[error("Protocol error: {0}")]
21    Protocol(#[from] ProtocolError),
22
23    #[error("Probe error: {0}")]
24    Probe(#[from] ProbeError),
25
26    #[error("Transport session error: {0}")]
27    Session(#[from] TransportSessionError),
28
29    #[error("Packet error: {0}")]
30    Packet(#[from] PacketError),
31
32    #[error("Type error: {0}")]
33    Types(#[from] hopr_internal_types::errors::CoreTypesError),
34
35    #[error("Network monitoring error: {0}")]
36    NetworkError(#[from] NetworkingError),
37
38    #[error(transparent)]
39    ApplicationLayerError(#[from] hopr_protocol_app::errors::ApplicationLayerError),
40
41    #[error(transparent)]
42    Other(Box<dyn std::error::Error + Send + Sync + 'static>),
43}
44
45/// Result produced by the crate, uses the [HoprTransportError] as the error type.
46pub type Result<T> = core::result::Result<T, HoprTransportError>;