Browse Source

Added a missing handling in case of an error

main
Unbewohnte 3 years ago
parent
commit
eb5cf32ce4
  1. 3
      dbHandle/handle.go

3
dbHandle/handle.go

@ -137,8 +137,11 @@ func (db *DB) HandleGlobalWeb(w http.ResponseWriter, r *http.Request) {
err = db.Create(*randomData) err = db.Create(*randomData)
if err != nil { if err != nil {
w.WriteHeader(http.StatusInternalServerError)
log.Printf("Could not create a row: %s", err) log.Printf("Could not create a row: %s", err)
return
} }
w.WriteHeader(http.StatusAccepted) w.WriteHeader(http.StatusAccepted)
case http.MethodGet: case http.MethodGet:

Loading…
Cancel
Save