mirror of
https://github.com/matrix-org/dendrite.git
synced 2024-11-29 17:51:56 -06:00
Check for sqlite3 constraint error
This commit is contained in:
parent
908edd304d
commit
ab2e2ce942
|
@ -27,8 +27,8 @@ import (
|
||||||
"github.com/matrix-org/gomatrixserverlib"
|
"github.com/matrix-org/gomatrixserverlib"
|
||||||
"golang.org/x/crypto/bcrypt"
|
"golang.org/x/crypto/bcrypt"
|
||||||
|
|
||||||
// Import the postgres database driver.
|
// Import the sqlite3 database driver.
|
||||||
_ "github.com/mattn/go-sqlite3"
|
"github.com/mattn/go-sqlite3"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Database represents an account database
|
// Database represents an account database
|
||||||
|
@ -172,7 +172,7 @@ func (d *Database) createAccount(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if err := d.profiles.insertProfile(ctx, txn, localpart); err != nil {
|
if err := d.profiles.insertProfile(ctx, txn, localpart); err != nil {
|
||||||
if internal.IsUniqueConstraintViolationErr(err) {
|
if errors.Is(err, sqlite3.ErrConstraint) {
|
||||||
return nil, internal.ErrUserExists
|
return nil, internal.ErrUserExists
|
||||||
}
|
}
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
Loading…
Reference in a new issue