use std::path::PathBuf;
use thiserror::Error;
pub type Result<T> = std::result::Result<T, PatchworksError>;
#[derive(Debug, Error)]
pub enum PatchworksError {
#[error("I/O error: {0}")]
Io(#[from] std::io::Error),
#[error("SQLite error: {0}")]
Sqlite(#[from] rusqlite::Error),
#[error("table `{table}` was not found in {path}")]
MissingTable { table: String, path: PathBuf },
#[error("a database path is required for this operation")]
MissingDatabasePath,
#[error("JSON serialization error: {0}")]
Json(#[from] serde_json::Error),
#[error("{0}")]
InvalidState(String),
}