1use std::path::PathBuf;
2
3#[derive(Debug, thiserror::Error)]
4pub enum Error {
5 #[error("vault file already exists: {0}")]
6 AlreadyExists(PathBuf),
7
8 #[error("vault file not found: {0}")]
9 NotFound(PathBuf),
10
11 #[error("entry not found: {0}")]
12 EntryNotFound(String),
13
14 #[error("invalid password or corrupted vault")]
15 BadPassword,
16
17 #[error("kdbx error: {0}")]
18 Kdbx(String),
19
20 #[error("io error: {0}")]
21 Io(#[from] std::io::Error),
22
23 #[error("invalid entry path: {0}")]
24 InvalidPath(String),
25
26 #[error("group not found: {0}")]
27 GroupNotFound(String),
28
29 #[error("group already exists: {0}")]
30 GroupExists(String),
31
32 #[error("group not empty: {0} (pass --recursive to delete it and its contents)")]
33 GroupNotEmpty(String),
34
35 #[error("entry has no otp field: {0} (set one with `trove add totp`)")]
36 NoTotp(String),
37
38 #[error("totp error: {0}")]
39 Totp(String),
40}