feat: output game id with log messages

This commit is contained in:
Settel 2022-03-16 09:39:22 +01:00
parent 4ba02e5881
commit f0a93cca20

View File

@ -53,12 +53,12 @@ func (app *Application) SavePlayer(usr *user.User, w http.ResponseWriter, r *htt
func (app *Application) modifyUser(id string, gm *game.Game, name, authcode string) error {
if usr, err := app.GetUserByAuthcode(authcode); err == nil && usr.GetId() != id {
return fmt.Errorf("authcode already in use")
return fmt.Errorf("%s authcode already in use", gm.GetId())
}
modifyUser := app.users[id]
if modifyUser.GetId() != id || modifyUser.GetGameId() != gm.GetId() {
return fmt.Errorf("couldn't find player %s in game %s", id, gm.GetId())
return fmt.Errorf("%s couldn't find player %s in game", gm.GetId(), id)
}
modifyUser.SetName(name)
modifyUser.SetAuthcode(authcode)
@ -71,7 +71,7 @@ func (app *Application) modifyUser(id string, gm *game.Game, name, authcode stri
func (app *Application) createUser(gm *game.Game, name, authcode string) error {
if _, err := app.GetUserByAuthcode(authcode); err == nil {
return fmt.Errorf("authcode already in use")
return fmt.Errorf("%s authcode already in use", gm.GetId())
}
dirName := path.Join(app.config.DataDir, "users")