Created
May 30, 2016 17:57
-
-
Save lmas/6a96353e7bc86e0d607b650d7f36e9f2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Source: https://github.com/mattn/go-sqlite3/pull/116 | |
if err.(sqlite3.Error).Code == sqlite3.ErrConstraint { | |
// clumsily compare err.Error() against strings to figure out what the heck happened... | |
} | |
// Additionally, the following is now possible: | |
if err.(sqlite3.Error).ExtendedCode == sqlite3.ErrConstraintUnique { | |
// oh! my unique constraint failed? | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment