mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-07-07 14:00:08 +02:00
sqldb: convert primary key violation to ErrSQLUniqueConstraintViolation
Besides the usual unique constraint violation that we already support we also want to return the same error if the primary key constraint is violated.
This commit is contained in:
@ -46,6 +46,11 @@ func parseSqliteError(sqliteErr *sqlite.Error) error {
|
||||
DBError: sqliteErr,
|
||||
}
|
||||
|
||||
case sqlite3.SQLITE_CONSTRAINT_PRIMARYKEY:
|
||||
return &ErrSQLUniqueConstraintViolation{
|
||||
DBError: sqliteErr,
|
||||
}
|
||||
|
||||
// Database is currently busy, so we'll need to try again.
|
||||
case sqlite3.SQLITE_BUSY:
|
||||
return &ErrSerializationError{
|
||||
|
Reference in New Issue
Block a user