feat: inc generic metric if error occurs #161

This commit is contained in:
2024-09-09 23:16:27 +02:00
parent 0e186940cc
commit 37c3b2a780
3 changed files with 33 additions and 14 deletions

View File

@@ -1,7 +1,6 @@
package service
import (
"log/slog"
"me-fit/template"
"me-fit/template/workout"
"me-fit/utils"
@@ -66,7 +65,7 @@ func HandleWorkoutNewComp(db *sql.DB) http.HandlerFunc {
var rowId int
err = db.QueryRow("INSERT INTO workout (user_id, date, type, sets, reps) VALUES (?, ?, ?, ?, ?) RETURNING rowid", user.Id, date, typeStr, sets, reps).Scan(&rowId)
if err != nil {
slog.Error(err.Error())
utils.LogError("Could not insert workout", err)
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}