keyring/
error.rs

1//! # Keyring errors
2//!
3//! Module dedicated to keyring errors. It contains an [`Error`] enum
4//! based on [`thiserror::Error`] and a type alias [`Result`].
5
6use thiserror::Error;
7
8use crate::native;
9
10/// The global `Result` alias of the library.
11pub type Result<T> = std::result::Result<T, Error>;
12
13/// The global `Error` enum of the library.
14#[derive(Debug, Error)]
15pub enum Error {
16    #[error("cannot build keyring entry using key `{1}`")]
17    BuildEntryError(#[source] native::Error, String),
18    #[error("cannot get secret from keyring matching `{1}`")]
19    GetSecretError(#[source] native::Error, String),
20    #[error("cannot find secret from keyring matching `{1}`")]
21    FindSecretError(#[source] native::Error, String),
22    #[error("cannot set secret from keyring matching `{1}`")]
23    SetSecretError(#[source] native::Error, String),
24    #[error("cannot delete secret from keyring matching `{1}`")]
25    DeleteSecretError(#[source] native::Error, String),
26
27    #[cfg(feature = "tokio")]
28    #[error(transparent)]
29    JoinError(#[from] tokio::task::JoinError),
30}