Skip to content

Commit

Permalink
fix(spx-backend): handle MySQL Error 1213 in `model.isUserDuplicateUs…
Browse files Browse the repository at this point in the history
…ernameError` (#1032)

Signed-off-by: Aofei Sheng <[email protected]>
  • Loading branch information
aofei authored Oct 25, 2024
1 parent df3a257 commit c34a0ff
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion spx-backend/internal/model/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ END
func isUserDuplicateUsernameError(err error) bool {
var mysqlError *mysql.MySQLError
if errors.As(err, &mysqlError) {
return mysqlError.Number == 1644 && mysqlError.Message == userDuplicateUsernameErrorMessage
return mysqlError.Number == 1213 || (mysqlError.Number == 1644 && mysqlError.Message == userDuplicateUsernameErrorMessage)
}
return false
}
Expand Down

0 comments on commit c34a0ff

Please sign in to comment.