Rename variable
This commit is contained in:
parent
c7bd7aff58
commit
3f4b0b5554
|
@ -121,7 +121,7 @@ func generateAppServiceAccount(
|
||||||
// Create an account for the application service
|
// Create an account for the application service
|
||||||
_, err := accountsDB.CreateAccount(ctx, as.SenderLocalpart, "", as.ID)
|
_, err := accountsDB.CreateAccount(ctx, as.SenderLocalpart, "", as.ID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if errors.Is(err, internal.ErrSQLUserExists) { // This account already exists
|
if errors.Is(err, internal.ErrUserExists) { // This account already exists
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
|
|
|
@ -164,7 +164,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 internal.IsUniqueConstraintViolationErr(err) {
|
||||||
return nil, internal.ErrSQLUserExists
|
return nil, internal.ErrUserExists
|
||||||
}
|
}
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -830,7 +830,7 @@ func completeRegistration(
|
||||||
|
|
||||||
acc, err := accountDB.CreateAccount(ctx, username, password, appserviceID)
|
acc, err := accountDB.CreateAccount(ctx, username, password, appserviceID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if errors.Is(err, internal.ErrSQLUserExists) { // user already exists
|
if errors.Is(err, internal.ErrUserExists) { // user already exists
|
||||||
return util.JSONResponse{
|
return util.JSONResponse{
|
||||||
Code: http.StatusBadRequest,
|
Code: http.StatusBadRequest,
|
||||||
JSON: jsonerror.UserInUse("Desired user ID is already taken."),
|
JSON: jsonerror.UserInUse("Desired user ID is already taken."),
|
||||||
|
|
|
@ -23,7 +23,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
// ErrUserExists is returned if a username already exists in the database.
|
// ErrUserExists is returned if a username already exists in the database.
|
||||||
var ErrSQLUserExists = errors.New("Username already exists")
|
var ErrUserExists = errors.New("Username already exists")
|
||||||
|
|
||||||
// A Transaction is something that can be committed or rolledback.
|
// A Transaction is something that can be committed or rolledback.
|
||||||
type Transaction interface {
|
type Transaction interface {
|
||||||
|
|
Loading…
Reference in a new issue