hopr_primitive_types/
errors.rs

1use thiserror::Error;
2
3/// Type for any possible error, because the traits in this module
4/// can be used in with any possible contexts (and error types).
5pub type AnyError = Box<dyn std::error::Error + Send + Sync + 'static>;
6
7/// Listing of some general re-usable errors
8#[derive(Error, Debug, PartialEq)]
9pub enum GeneralError {
10    #[error("failed to parse/deserialize the data: {0}")]
11    ParseError(String),
12
13    #[error("input argument to the function is invalid")]
14    InvalidInput,
15
16    #[error("non-specific error: {0}")]
17    NonSpecificError(String),
18}
19
20pub type Result<T> = core::result::Result<T, GeneralError>;