hopr_path/
errors.rs

1use hopr_primitive_types::errors::GeneralError;
2use thiserror::Error;
3
4/// Lists all errors in this crate.
5#[derive(Error, Debug)]
6pub enum PathError {
7    #[error("path is not valid")]
8    PathNotValid,
9
10    #[error("path contains an invalid peer id: {0}")]
11    InvalidPeer(String),
12
13    #[error("path contains a unknown peer that cannot be resolved: {0}")]
14    UnknownPeer(String),
15
16    #[error("missing channel between {0} and {1}")]
17    MissingChannel(String, String),
18
19    #[error("channel between {0} and {1} is not opened")]
20    ChannelNotOpened(String, String),
21
22    #[error("path contains loop on {0}")]
23    LoopsNotAllowed(String),
24
25    #[error("cannot find {0} hop path {1} -> {2} in the channel graph")]
26    PathNotFound(usize, String, String),
27
28    #[error(transparent)]
29    OtherError(#[from] GeneralError),
30}
31
32pub type Result<T> = std::result::Result<T, PathError>;