data DbError
A database operation failed: Conflict (duplicate key, violated unique index), NotFound (update or delete of a
missing row), Busy (locked by another connection, or a builtin shard transaction to retry after a leader change), Other,
CrossShardTx (an atomic/transaction touched rows of two shards of builtin://; 2PC is 1.0, D-4387).
Example:
use std.orm { Db }
@table("notes")
data Note {
@pk id: i64
text: str
}
fn main() io, db {
let db = Db.open("sqlite::memory:")!
db.insert(Note{ id: 1, text: "a" })
match db.tryInsert(Note{ id: 1, text: "b" }) {
DbError e => print("{e.kind == DbErrorKind.Conflict}")
_ => print("inserted twice?")
}
}Output
true
@error pub(api) data DbErrorSince. 1.0.0-beta
Fields
pub(api) kind: DbErrorKind | What went wrong. |
pub(api) msg: str | Detail text of the database. |
Defined in: std/core/types.oxl:318