Skip to content

Error handling of query (constraints, SQLite) #1282

Answered by mehcode
AxelMontini asked this question in Q&A
Discussion options

You must be logged in to vote

The .code() method on SqliteError should return "2067" for a unique failure. You can't get the exact constraint name with sqlite but you'll at least know its because of a unique constraint.

See https://www.sqlite.org/rescode.html for more codes. It could make sense to have a SqliteErrorKind like std::io::ErrorKind to enum those.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@AxelMontini
Comment options

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