Skip to content
Discussion options

You must be logged in to vote

Hey @Samiisd, welcome!! Please upgrade to 0.10.1. We just updated the DbErr you can now match the error code thrown by the database.

Example:

let mud_cake = cake::ActiveModel {
name: Set("Moldy Cake".to_owned()),
price: Set(dec!(10.25)),
gluten_free: Set(false),
serial: Set(Uuid::new_v4()),
bakery_id: Set(None),
..Default::default()
};
let cake = mud_cake.save(db).await.expect("could not insert cake");
// if compiling without sqlx, this assignment will complain,
// but the whole test is useless in that case anyway.
#[allow(unused_variables)]
let error: DbErr

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@Samiisd
Comment options

@tyt2y3
Comment options

Answer selected by Samiisd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #1144 on October 25, 2022 15:49.