OxL Reference

type DbError

A failed database operation: kind (Conflict, NotFound, Busy, Other, CrossShardTx) and msg.

Example:

oxl✓ checked in CI
use std.orm { Db }

@table("items")
data Item {
  @pk id: i64
  name: str
  price: i64
}

fn main() io, db {
  let db = Db.open("sqlite::memory:")!
  db.insert(Item{ id: 1, name: "tea", price: 3 })
  match db.tryInsert(Item{ id: 1, name: "again", price: 4 }) {
    DbError e => print("{e.kind == DbErrorKind.Conflict}")
    _ => print("stored twice")
  }
  db.close()
}
Output
true
pub(api) type DbError = std.core.DbError

Since. 1.0.0-beta

Methods

show() -> str
The error as text

Defined in: std/orm/orm.oxl:237

See also