Better error handling in handlers.game

This commit is contained in:
Vojtěch Káně
2021-04-25 14:03:54 +02:00
parent 531687bac3
commit 5dae8a7ad7

View File

@@ -123,9 +123,12 @@ func (app *application) game(w http.ResponseWriter, r *http.Request, params http
td.P = player td.P = player
app.render(w, r, "game.page.tmpl.html", td) app.render(w, r, "game.page.tmpl.html", td)
} else { } else if errors.Is(err, model.NoSuchEntity) {
app.clientError(w, http.StatusNotFound) app.clientError(w, http.StatusNotFound)
return return
} else {
app.serverError(w, err)
return
} }
} }