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