melwallet_client/
errors.rs

1use http_types::StatusCode;
2use thiserror::Error;
3
4#[derive(Error, Debug)]
5pub enum DaemonError {
6    #[error("access denied")]
7    AccessDenied,
8    #[error("HTTP error: {0}")]
9    Http(http_types::Error),
10    #[error("other error: {0}")]
11    Other(String),
12}
13
14impl From<http_types::Error> for DaemonError {
15    fn from(e: http_types::Error) -> Self {
16        if e.status() == StatusCode::Forbidden {
17            Self::AccessDenied
18        } else {
19            Self::Http(e)
20        }
21    }
22}