OxL Reference

enum DbErrorKind

Why a database operation failed.

Example:

oxl✓ checked in CI
fn advice(k: DbErrorKind) -> str {
  match k {
    .Conflict => "the key exists"
    .NotFound => "no such row"
    .Busy => "retry"
    .Other => "give up"
    .CrossShardTx => "keep a transaction on one shard"
  }
}

fn main() io {
  print(advice(DbErrorKind.Busy))
}
Output
retry
pub(api) enum DbErrorKind

Since. 1.0.0-beta

Variants

Conflict

A duplicate key or a violated unique index.

NotFound

An update or delete of a row that does not exist.

Busy

Locked by another connection, or a transaction to retry after a leader change.

Other

Any other failure.

CrossShardTx

A transaction touched rows of two shards.

Defined in: std/core/types.oxl:280

See also