1use thiserror::Error;
7
8#[derive(Error, Debug)]
10pub enum Error {
11 #[error(transparent)]
13 IoError(#[from] std::io::Error),
14
15 #[error(transparent)]
17 ParsecClientError(#[from] parsec_client::error::Error),
18
19 #[error(transparent)]
21 ParsecInterfaceError(#[from] parsec_client::core::interface::requests::ResponseStatus),
22
23 #[error(transparent)]
25 ParsecToolError(#[from] ToolErrorKind),
26
27 #[error(transparent)]
29 Base64Decode(#[from] base64::DecodeError),
30
31 #[error(transparent)]
33 RcgenError(#[from] rcgen::RcgenError),
34}
35
36#[derive(Error, Debug)]
38pub enum ToolErrorKind {
39 #[error("Operation not supported by the parsec-tool")]
41 NotSupported,
42
43 #[error("They key was not created with the correct algorithm for this operation")]
45 WrongKeyAlgorithm,
46
47 #[error("A command expected input data that was not given")]
49 NoInput,
50
51 #[error("Incorrect data format")]
53 IncorrectData,
54}
55
56pub type Result<T> = std::result::Result<T, Error>;