1use std::fmt;
What can go wrong with the database. What the adapters report to their ports is only a sentence for the log (the ports' own errors say whether to retry); this keeps the cause.
SQLite refused or failed.
8 Sqlite(rusqlite::Error),
The database was written by a newer build than this one.
10 Newer { found: u32, known: u32 },
Something another connection holds stopped a checkpoint.
12 Busy,
17impl fmt::Display for DbError { 18 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { 19 match self { 20 DbError::Sqlite(e) => write!(f, "database error: {e}"), 21 DbError::Newer { found, known } => write!(f, "the database is at version {found}, newer than this build's {known}"), 22 DbError::Busy => write!(f, "the database is busy"), 23 DbError::Damaged(what) => write!(f, "the database is damaged: {what}"), 24 } 25 } 26} 27 28impl DbError {
Whether what is stored is not a database at all, or is broken beyond reading: the file is damaged and not merely busy, full or from a newer build.
Whether the database was written by a newer build.