hopr_transport_session/
errors.rs1use crate::initiation::StartErrorReason;
2use thiserror::Error;
3
4#[derive(Error, Debug)]
6pub enum TransportSessionError {
7 #[error("connection timed out")]
8 Timeout,
9
10 #[error("application tag from disallowed range")]
11 Tag,
12
13 #[error("incorrect data size")]
14 PayloadSize,
15
16 #[error("serializer encoding error: {0}")]
17 SerializerEncoding(#[from] bincode::error::EncodeError),
18
19 #[error("serializer decoding error: {0}")]
20 SerializerDecoding(#[from] bincode::error::DecodeError),
21
22 #[error("invalid peer id")]
23 PeerId,
24
25 #[error("impossible transport path")]
26 Path,
27
28 #[error("the other party rejected session initiation with error: {0}")]
29 Rejected(StartErrorReason),
30
31 #[error("received data for an unregistered session")]
32 UnknownData,
33
34 #[error(transparent)]
35 Manager(#[from] SessionManagerError),
36
37 #[error(transparent)]
38 Network(#[from] hopr_network_types::errors::NetworkTypeError),
39
40 #[error("session is closed")]
41 Closed,
42}
43
44#[derive(Error, Debug)]
45pub enum SessionManagerError {
46 #[error("manager is not started")]
47 NotStarted,
48 #[error("manager is already started")]
49 AlreadyStarted,
50 #[error("no session backrouting information was given")]
51 NoBackRoutingInfo,
52 #[error("all challenge slots are occupied")]
53 NoChallengeSlots,
54 #[error("non-specific session manager error: {0}")]
55 Other(String),
56}
57
58pub type Result<T> = std::result::Result<T, TransportSessionError>;