From 9dbabed6e75ffd13bd5b430767a5672fa63adcb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20W=C3=BCstenberg?= Date: Thu, 27 Oct 2022 12:00:13 +0200 Subject: [PATCH] Fix HTTP error code and message on database insert error --- cmd/litefs-example/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/litefs-example/main.go b/cmd/litefs-example/main.go index 391e9e6..ad6d067 100644 --- a/cmd/litefs-example/main.go +++ b/cmd/litefs-example/main.go @@ -158,7 +158,7 @@ func handleGenerate(w http.ResponseWriter, r *http.Request) { Company: gofakeit.Company(), } if _, err := db.ExecContext(r.Context(), `INSERT INTO persons (name, phone, company) VALUES (?, ?, ?)`, person.Name, person.Phone, person.Company); err != nil { - http.Error(w, "Method not alllowed", http.StatusMethodNotAllowed) + http.Error(w, err.Error(), http.StatusInternalServerError) return }