Skip to content

Commit

Permalink
Better error handling in handlers.game
Browse files Browse the repository at this point in the history
  • Loading branch information
vojta001 committed Apr 25, 2021
1 parent 531687b commit 5dae8a7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion cmd/web/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,12 @@ func (app *application) game(w http.ResponseWriter, r *http.Request, params http
td.P = player

app.render(w, r, "game.page.tmpl.html", td)
} else {
} else if errors.Is(err, model.NoSuchEntity) {
app.clientError(w, http.StatusNotFound)
return
} else {
app.serverError(w, err)
return
}
}

Expand Down

0 comments on commit 5dae8a7

Please sign in to comment.