hopr_transport_protocol/
errors.rs

1use hopr_internal_types::errors::CoreTypesError;
2use hopr_primitive_types::errors::GeneralError;
3use thiserror::Error;
4
5/// Errors generated by the crate.
6#[derive(Error, Debug)]
7pub enum ProtocolError {
8    #[error("timeout on protocol operation")]
9    Timeout,
10
11    #[error(transparent)]
12    Other(Box<dyn std::error::Error + Send + Sync + 'static>),
13
14    #[error("General error {0}")]
15    GeneralError(#[from] GeneralError),
16
17    #[error("Core error {0}")]
18    CoreError(#[from] CoreTypesError),
19
20    #[error("Failed on a logical error: {0}")]
21    Logic(String),
22}
23
24/// Result used by the crate, based on the [ProtocolError] error type.
25pub type Result<T> = core::result::Result<T, ProtocolError>;