1use std::path::PathBuf;
4
5use chrono::{DateTime, Utc};
6
7use crate::SystemState;
8
9#[derive(Debug, thiserror::Error)]
11pub enum Error {
12 #[error("Configuration issue: {0}")]
14 Config(#[from] crate::cli::config::Error),
15
16 #[error("The NetHsm is locked")]
18 Locked,
19
20 #[error("The NetHSM is failed")]
22 Failed,
23
24 #[error("The NetHSM system state is unknown: {system_state:?}")]
26 UnknownSystemState {
27 system_state: SystemState,
29 },
30
31 #[error("I/O error: {0}")]
33 Io(#[from] std::io::Error),
34
35 #[error("Failed to open output file: {0}")]
37 OutputFileOpen(PathBuf),
38
39 #[error("The output file exists already: {0}")]
41 OutputFileExists(PathBuf),
42
43 #[error("Backup file is corrupted: {0}")]
45 Backup(#[from] crate::backup::Error),
46
47 #[error("Request deserialization failed: {0}")]
49 Request(#[from] Box<signstar_request_signature::Error>),
50
51 #[error("Signing request processing error: {0}")]
53 SigningRequest(String),
54
55 #[error("Given time cannot be represented in OpenPGP: {0}")]
57 InvalidTime(DateTime<Utc>),
58
59 #[error(
61 "The \"{0}\" option must be provided for this command if more than one environment is defined."
62 )]
63 OptionMissing(String),
64}