Skip to main content

vs_store/
error.rs

1//! Crate-wide error type for `vs-store`.
2
3#[derive(Debug, thiserror::Error)]
4#[non_exhaustive]
5pub enum StoreError {
6    #[error("sqlite: {0}")]
7    Sqlite(#[from] rusqlite::Error),
8
9    #[error("io: {0}")]
10    Io(#[from] std::io::Error),
11
12    #[error("crypto: {0}")]
13    Crypto(&'static str),
14
15    #[error("keyring: {0}")]
16    Keyring(String),
17
18    #[error("not found: {kind} {id}")]
19    NotFound { kind: &'static str, id: String },
20
21    #[error("conflict: {0}")]
22    Conflict(&'static str),
23
24    #[error("invalid input: {0}")]
25    Invalid(&'static str),
26
27    #[error("master key file is the wrong size: expected 32 bytes, got {0}")]
28    KeyFileSize(usize),
29}
30
31pub type Result<T> = std::result::Result<T, StoreError>;