error.rs
 1  #[derive(Debug, thiserror::Error)]
 2  pub enum Error {
 3      #[error(transparent)]
 4      Io(#[from] std::io::Error),
 5  
 6      #[error(transparent)]
 7      SerdeJson(#[from] serde_json::Error),
 8  
 9      #[error(transparent)]
10      TryFromNodeId(#[from] distrox_model::node::NodeIdError),
11  
12      #[error(transparent)]
13      TryFromNode(#[from] crate::model::TryFromNodeError),
14  
15      #[error("Failed to read private key at {}", .path)]
16      ReadingPrivateKey {
17          #[source]
18          source: std::io::Error,
19          path: camino::Utf8PathBuf,
20      },
21  
22      #[error("Failed to read public key at {}", .path)]
23      ReadingPublicKey {
24          #[source]
25          source: std::io::Error,
26          path: camino::Utf8PathBuf,
27      },
28  }
29  
30  impl From<Error> for distrox_api::node::NodeError {
31      fn from(value: Error) -> Self {
32          distrox_api::node::NodeError(Box::new(value))
33      }
34  }
35  
36  impl From<Error> for distrox_api::content::ContentError {
37      fn from(value: Error) -> Self {
38          distrox_api::content::ContentError(Box::new(value))
39      }
40  }