Closed rchatsiri closed 4 years ago
Hi!
The MySqlError
type exposes state
, message
and code
fields:
match stmt.execute(params! { /* ... */ }) {
Ok(_) => (/* inserted */),
Err(my::Error::MySqlError(err)) => (/* your handler logic here */),
}
I would suggest, however, to consider other approaches. See here for example.
I'm insert data into
stmt.execute()
as example below, but database found an error from duplicate primary key and send an error back to execute function. How to handle an error frommatch
keyword.