Skip to main content

signstar_host/
error.rs

1//! Error handling.
2
3/// An error that may occur when using Signstar hosts.
4#[derive(Debug, thiserror::Error)]
5pub enum Error {
6    /// An error occurred while configuring a Signstar host.
7    #[error("Signstar host configure error: {0}")]
8    Configure(#[from] crate::configure::Error),
9
10    /// An error occurred while configuring a Signstar host during image build.
11    #[error("Signstar host configure build error: {0}")]
12    ConfigureBuild(#[from] crate::configure_build::Error),
13
14    /// An error occurred while making key certificates available for download on a Signstar host.
15    #[error("Signstar download key certificates error: {0}")]
16    DownloadKeyCertificates(#[from] crate::download_key_certificates::Error),
17
18    /// A JSON serialization error occurred.
19    #[error("JSON serialization error: {0}")]
20    JsonSerialization(#[from] serde_json::Error),
21
22    /// A [`nethsm::Error`] occurred.
23    #[cfg(feature = "nethsm")]
24    #[error("NetHsm error")]
25    NetHsm(#[from] nethsm::Error),
26
27    /// A [`std::num::ParseIntError`] occurred.
28    #[cfg(feature = "yubihsm2")]
29    #[error(transparent)]
30    ParseIntError(#[from] std::num::ParseIntError),
31
32    /// An error occurred while signing with a Signstar host.
33    #[error("Signstar host signing error: {0}")]
34    Sign(#[from] crate::sign::Error),
35
36    /// A [`signstar_common::Error`] occurred.
37    #[error("Signstar common error: {0}")]
38    SignstarCommon(#[from] signstar_common::Error),
39
40    /// A [`signstar_config::Error`] occurred.
41    #[error(transparent)]
42    SignstarConfig(#[from] Box<signstar_config::Error>),
43
44    /// A [`signstar_crypto::Error`] occurred.
45    #[error(transparent)]
46    SignstarCrypto(#[from] signstar_crypto::Error),
47
48    /// A [`signstar_yubihsm2::Error`] occurred.
49    #[cfg(feature = "yubihsm2")]
50    #[error(transparent)]
51    SignstarYubiHsm2(#[from] signstar_yubihsm2::Error),
52}