pub enum DbError {
Open {
path: PathBuf,
source: Error,
},
PrepareDir {
path: PathBuf,
source: Error,
},
Pragma(Error),
Schema(Error),
RagSchema(Error),
BackupFailed {
path: PathBuf,
source: Error,
},
EmbeddingDimension(Error),
SchemaDrift {
expected: u32,
stored: u32,
},
Sqlite(Error),
}Expand description
Typed errors for the database-open and schema-migration paths.
The rest of the query API still returns anyhow::Result for now;
this enum exists so callers (the binary, MCP server, plugin authors)
can pattern-match on the actionable failure modes around opening a
database — especially distinguishing a corrupt file from a missing
one from a schema incompatibility. A From<DbError> impl on
anyhow::Error is provided automatically by the trait blanket, so
existing ?-based call sites keep working unchanged.
Variants§
Open
Failure opening or creating the SQLite file itself (permission denied, path missing, disk full, etc.).
PrepareDir
Failure preparing the on-disk layout (e.g. could not create the
.cartog/ parent directory).
Pragma(Error)
Could not apply one of the startup PRAGMAs (journal_mode, WAL, …).
Schema(Error)
Could not apply the CREATE TABLE IF NOT EXISTS schema bootstrap.
RagSchema(Error)
Could not create or migrate the RAG (FTS + vector) tables.
BackupFailed
Pre-migration backup via VACUUM INTO failed.
EmbeddingDimension(Error)
Embedding-dimension reconciliation failed (the stored symbol_vec
shape didn’t match the requested one and we couldn’t rebuild it).
SchemaDrift
Read-only attach found a schema_version on disk that this binary
doesn’t know how to query. The primary writer was upgraded to a
newer cartog; the read-only client should exit cleanly and let the
user restart against the new version.
Sqlite(Error)
A catch-all for other rusqlite-level failures inside open —
use more specific variants whenever they fit.
Trait Implementations§
Source§impl Error for DbError
impl Error for DbError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()