#[non_exhaustive]pub enum DatabaseError {
Storage(String),
Sql {
message: String,
},
AsyncContext,
EngineUnavailable(Engine),
Reentrant,
}Expand description
Errors from a Database operation.
thiserror-derived per docs/CODE_STANDARDS.md: callers match on the
variant rather than only displaying it.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Storage(String)
A database path couldn’t be resolved, created, or otherwise accessed — an unset data directory, an invalid database name, or an underlying filesystem failure.
Sql
The SQL engine reported a statement failure (a syntax error, a constraint violation, a type mismatch — whatever the engine itself surfaces).
AsyncContext
Reserved for async-bridging backends: a synchronous call ran from
inside an async runtime worker thread, which the turso engine’s
async bridge can’t safely block on. engine-sqlite’s connection
never raises this — declared now so this enum stays additive-stable
once the turso backend needs it.
The requested (or resolved-default) Engine isn’t compiled into
this build.
Reserved, and unconstructable by any of today’s code paths: an
Engine variant only exists at all when the feature compiling its
backend is on, so an engine a caller can name is by construction
compiled in — see Database::open’s own Errors section for what
the neither-engine-compiled build reports instead.
Reentrant
A call re-entered a Database handle the calling thread already
holds — typically an execute/query/transaction issued on a
captured (e.g. Arc-shared) handle from inside that same handle’s
Database::transaction closure.
Reported rather than deadlocking on the handle’s non-reentrant
connection mutex: run statements inside a transaction through the
Transaction handle the closure is given. Calls from other
threads are unaffected — they queue on the mutex as the module doc’s
Threading model section promises.
Trait Implementations§
Source§impl Debug for DatabaseError
impl Debug for DatabaseError
Source§impl Display for DatabaseError
impl Display for DatabaseError
Source§impl Error for DatabaseError
impl Error for DatabaseError
1.30.0 · 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()