khive_db/error.rs
1//! Error types for the SQLite storage layer.
2
3use thiserror::Error;
4
5/// Errors produced by the SQLite storage backend.
6#[derive(Debug, Error)]
7pub enum SqliteError {
8 /// Underlying rusqlite driver error.
9 #[error("sqlite error: {0}")]
10 Rusqlite(#[from] rusqlite::Error),
11
12 /// Data invariant violation (corrupt row, unexpected schema state).
13 #[error("invalid data: {0}")]
14 InvalidData(String),
15
16 /// Filesystem I/O error.
17 #[error("io error: {0}")]
18 Io(#[from] std::io::Error),
19
20 /// A versioned migration failed to apply.
21 #[error("migration v{version} failed: {error}")]
22 Migration {
23 /// The migration version number that failed.
24 version: u32,
25 /// Human-readable description of the failure.
26 error: String,
27 },
28}