capsule_library/library/
error.rs1use thiserror::Error;
2
3#[derive(Debug, Error)]
4pub enum LibraryError {
5 #[error("library already exists at {0}")]
6 AlreadyExists(std::path::PathBuf),
7
8 #[error("directory is not empty")]
9 DirectoryNotEmpty,
10
11 #[error("corrupt or missing version file: {0}")]
12 CorruptVersion(String),
13
14 #[error("library is locked by PID {pid} on {hostname} (locked at {locked_at})")]
15 Locked {
16 pid: u32,
17 hostname: String,
18 locked_at: i64,
19 },
20
21 #[error("version mismatch: found {found}, expected {expected}")]
22 VersionMismatch { found: u8, expected: u8 },
23
24 #[error(
32 "catalog schema v{found} is newer than this build supports (v{supported}); \
33 update Capsule to open this library"
34 )]
35 CatalogTooNew { found: u32, supported: u32 },
36
37 #[error("I/O error: {0}")]
38 Io(#[from] std::io::Error),
39
40 #[error("database error: {0}")]
41 Db(#[from] rusqlite::Error),
42
43 #[error("CBOR error: {0}")]
44 Cbor(String),
45}