From 5dae8a7ad7671d4294453be1e8542701f719214e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vojt=C4=9Bch=20K=C3=A1n=C4=9B?= Date: Sun, 25 Apr 2021 14:03:54 +0200 Subject: [PATCH] Better error handling in handlers.game --- cmd/web/handlers.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cmd/web/handlers.go b/cmd/web/handlers.go index aab34c5..f0fb5b5 100644 --- a/cmd/web/handlers.go +++ b/cmd/web/handlers.go @@ -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 } }