pub enum DbError {
Sql(String),
UniqueViolation,
TypeMismatch {
col: usize,
expected: &'static str,
},
IntegerOutOfRange(i128),
ColumnOutOfBounds(usize),
UnexpectedNull(usize),
}Expand description
An error from a SQL backend operation.
Variants§
Sql(String)
A backend error with no more specific variant; carries the backend’s own message.
UniqueViolation
A UNIQUE / PRIMARY KEY conflict. A tracker that keys the op-log on
(peer_id, entry_idx) surfaces a re-ingested entry as this — failing the
batch so the whole apply rolls back rather than double-applying, not a
silent skip. Each backend must map its native constraint error to this
variant.
TypeMismatch
A column held a value of a different type than the caller requested.
Fields
IntegerOutOfRange(i128)
A u64 (e.g. a packed HLC timestamp) didn’t fit the signed 64-bit
integer a SQL backend stores. On a write the value exceeded i64::MAX;
on a read the stored value was negative. Either way it can’t round-trip
through a signed column — and the signed MAX/GREATEST merge guard
would misorder it — so we reject rather than silently wrap. The i128
holds the offending value losslessly in both directions.
ColumnOutOfBounds(usize)
A column index past the end of the row was requested.
UnexpectedNull(usize)
A column was SQL NULL where the caller required a non-null value.
Trait Implementations§
Source§impl Error for DbError
impl Error for DbError
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()