#[non_exhaustive]pub enum ErrorKind {
Integrity,
Validation,
Vector,
Temporal,
Writer,
Budget,
Branch,
Cancelled,
Diagnostic,
Engine,
Migration,
NotFound,
}Expand description
What kind of failure a DbError is, as a value (0.14.25, §14.1 C-3,
D-242).
§Why this exists
DbError is #[non_exhaustive] (D-207), so a downstream match needs
a wildcard arm and can never be checked for completeness by the compiler.
That was a deliberate trade — a ledger that will certainly add error
variants after 1.0 cannot make each addition a major version — and its
price was paid by callers, who lost the one guarantee that told them they
had considered everything.
This buys part of it back, and the part it buys back is inside this
crate: DbError::kind is one exhaustive match with no wildcard, so a
variant added without a classification does not compile. The decision moves
to the person adding the variant, at the line that needs it, which is
exactly what crate::DbError’s binding lost in 0.13.34.
§The taxonomy is not new
These twelve names are the hierarchy the Python bindings have published
since they existed — seven groups a caller can catch as a set, and five
failures that belong to no group. Inventing a second, Rust-only taxonomy
here would be D-227’s finding again: a surface that spells its own
version of a shared thing misses every repair made to the shared thing,
quietly. binding_parity_tests pins the two spellings together.
§What it is not
It is not a replacement for matching on DbError itself. A caller who
needs the path a snapshot failed to write still matches the variant; this
answers the coarser question — whose problem is this, and can I retry it —
and, being Copy + Eq + Hash, answers it somewhere a DbError cannot go:
a metrics key, a log field, a counter.
It is #[non_exhaustive] for the same reason DbError is. An exhaustive
ErrorKind would give downstream its compile-time completeness back, and
would do it by making a genuinely new category of failure a major
version — which is the trap D-207 rejected by name, one level up: the
category would then not get added, and the ledger would report the wrong
kind rather than a new one.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Integrity
The ledger’s own invariants: overlap, drift, a leaked archive session, a rebuild that failed or was interrupted. Something is wrong with the data or with a repair of it, and no retry fixes it.
Validation
The caller’s input was refused before anything was attempted.
Vector
Embeddings and the model registry.
Temporal
Time, snapshots and the archive — the bitemporal machinery.
Writer
The write actor could not take, keep, or answer the request.
Budget
A bound the caller set, or one the crate sets on the caller’s behalf.
Branch
Lineage: a branch that does not exist, cannot be forked, or may not be named from where the caller is standing.
Cancelled
A chunked bulk write stopped between chunks. Distinct from every other
kind because part of it landed — see BulkInterrupted.
Diagnostic
The read-only diagnostic connection.
Engine
libSQL itself, passed through.
Migration
Schema migration.
NotFound
The thing asked for is not there.
Implementations§
Trait Implementations§
impl Copy for ErrorKind
impl Eq for ErrorKind
Source§impl Ord for ErrorKind
impl Ord for ErrorKind
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for ErrorKind
impl PartialOrd for ErrorKind
impl StructuralPartialEq for ErrorKind
Auto Trait Implementations§
impl Freeze for ErrorKind
impl RefUnwindSafe for ErrorKind
impl Send for ErrorKind
impl Sync for ErrorKind
impl Unpin for ErrorKind
impl UnsafeUnpin for ErrorKind
impl UnwindSafe for ErrorKind
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request