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 /// Empty set of domains encountered.
7 #[error("Empty set of domains encountered")]
8 EmptySetOfDomains,
9
10 /// A [`getrandom::Error`] occurred.
11 #[error("Get random error while {context}: {source}")]
12 GetRandom {
13 /// The context in which the error occurred.
14 ///
15 /// This is meant to complete the sentence "Get random error while ".
16 context: &'static str,
17
18 /// The error source.
19 source: getrandom::Error,
20 },
21
22 /// An [`argon2::Error`] occurred.
23 #[error("Argon2 error while {context}: {source}")]
24 Argon2 {
25 /// The context in which the error occurred.
26 ///
27 /// This is meant to complete the sentence "Argon2 error while ".
28 context: &'static str,
29
30 /// The error source.
31 source: argon2::Error,
32 },
33}