keyring_search/
error.rs

1#[derive(Debug)]
2#[non_exhaustive]
3pub enum Error {
4    SearchError(String),
5    Unexpected(String),
6    NoResults,
7}
8
9pub type Result<T> = std::result::Result<T, Error>;
10
11impl std::fmt::Display for Error {
12    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
13        match self {
14            Error::SearchError(reason) => {
15                write!(f, "Error searching for credential: {}", reason)
16            }
17            Error::Unexpected(reason) => {
18                write!(f, "Unexpected result from: {}", reason)
19            }
20            Error::NoResults => {
21                write!(f, "Search returned no results")
22            }
23        }
24    }
25}