From eb5cf32ce4b0902414ce993f6e5490b7c22fe3dd Mon Sep 17 00:00:00 2001 From: Unbewohnte Date: Thu, 23 Sep 2021 10:29:28 +0300 Subject: [PATCH] Added a missing handling in case of an error --- dbHandle/handle.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dbHandle/handle.go b/dbHandle/handle.go index b27dc8a..10d2591 100644 --- a/dbHandle/handle.go +++ b/dbHandle/handle.go @@ -137,8 +137,11 @@ func (db *DB) HandleGlobalWeb(w http.ResponseWriter, r *http.Request) { err = db.Create(*randomData) if err != nil { + w.WriteHeader(http.StatusInternalServerError) log.Printf("Could not create a row: %s", err) + return } + w.WriteHeader(http.StatusAccepted) case http.MethodGet: