use thiserror::Error;
use super::{EdgeId, NodeId};
#[derive(Debug, Error)]
pub enum DbError {
#[error("Node {0} not found")]
NodeNotFound(NodeId),
#[error("Edge {0} not found")]
EdgeNotFound(EdgeId),
#[error("Node {0} has existing edges; use DETACH DELETE to remove with edges")]
NodeHasEdges(NodeId),
#[error("Storage error: {0}")]
Storage(#[from] std::io::Error),
#[error("Serialization error: {0}")]
Serialization(String),
#[error("WAL frame corrupted (CRC mismatch or bad magic)")]
CorruptFrame,
#[error("Transaction already committed or rolled back")]
TransactionFinished,
#[error("Parse error: {0}")]
Parse(String),
#[error("Query error: {0}")]
Query(String),
#[error("RocksDB error: {0}")]
RocksDb(String),
#[error("Constraint violation: {0}")]
ConstraintViolation(String),
}