Skip to main content

signstar_yubihsm2/object/
error.rs

1//! Error handling for objects used in signstar-yubihsm2.
2
3/// The error that may occur when using a YubiHSM2 device.
4#[derive(Debug, thiserror::Error)]
5pub enum Error {
6    /// An ID is invalid.
7    #[error("YubiHSM2 ID {id} is invalid, because {reason}")]
8    InvalidId {
9        /// The reason why the `id` is invalid.
10        ///
11        /// This is supposed to complete the sentence "YubiHSM2 ID {id} is invalid, because ".
12        reason: String,
13
14        /// The invalid ID.
15        id: String,
16    },
17
18    /// Empty set of domains encountered.
19    #[error("Empty set of domains encountered")]
20    EmptySetOfDomains,
21}