Improve error handling in GenerateIdForNewUser()

This commit is contained in:
Yang Luo
2023-12-14 10:11:06 +08:00
parent 85b86e8831
commit 5c103e8cd3
2 changed files with 17 additions and 1 deletions

View File

@ -1021,7 +1021,10 @@ func GenerateIdForNewUser(application *Application) (string, error) {
lastUserId := -1
if lastUser != nil {
lastUserId = util.ParseInt(lastUser.Id)
lastUserId, err = util.ParseIntWithError(lastUser.Id)
if err != nil {
return util.GenerateId(), nil
}
}
res := strconv.Itoa(lastUserId + 1)