use thiserror::Error;
#[derive(Error, Debug)]
pub enum PgDbError {
#[error("Unsupported database engine '{engine}'. Valid engines are: lbug")]
UnsupportedEngine { engine: String },
#[error("Unsupported DDL dialect '{dialect}'. Valid dialects are: cypher, gql")]
UnsupportedDialect { dialect: String },
#[error("Data source specification error: {message}")]
DataSourceSpec { message: String },
#[error("Failed to open database at '{path}': {error}")]
FailedOpenDatabase { path: String, error: String },
#[error("Failed to connect to database: {error}")]
FailedConnect { error: String },
#[error("No database specified. Call `connect_pg_db` first, or pass an explicit database path.")]
NoConnection,
#[error("The database connection in use is read-only; a writable database is required")]
ReadOnlyConnection,
#[error("Failed to create table '{table}': {error}")]
FailedCreateTable { table: String, error: String },
#[error("Failed to insert node into '{table}': {error}")]
FailedInsertNode { table: String, error: String },
#[error("Cypher query failed: {error}")]
FailedCypherQuery { error: String },
#[error("No RDF data loaded to derive a property graph schema from")]
NoDataLoaded,
#[error("Data does not conform to SHACL shapes; aborting load ({violations} violation(s))")]
ShaclViolations { violations: usize },
#[error("Failed I/O operation: {error}")]
FailedIoOperation { error: String },
}