#[derive(Debug, thiserror::Error)]
pub enum StorageError {
#[error("Failed to open database at {path}: {reason}")]
OpenError { path: String, reason: String },
#[error("Migration failed: {0}")]
MigrationError(String),
#[error("Query error: {0}")]
QueryError(String),
#[error("IR serialization error: {0}")]
SerializationError(String),
#[error("Stale IR: cached version {cached} != current version {current}")]
StaleIR { cached: u8, current: u8 },
#[error("{entity} not found: {id}")]
NotFound { entity: &'static str, id: String },
#[error("SQLite error: {0}")]
Sqlite(#[from] rusqlite::Error),
#[error("IO error: {0}")]
Io(#[from] std::io::Error),
}