From 7f3eb443d937fc519480f494e2641c7ca9741505 Mon Sep 17 00:00:00 2001 From: Jan Eitzinger Date: Mon, 16 Mar 2026 15:42:38 +0100 Subject: [PATCH] Include calling function in error message Entire-Checkpoint: a4948d0fe7a3 --- internal/api/rest.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/internal/api/rest.go b/internal/api/rest.go index 613867a8..cb041012 100644 --- a/internal/api/rest.go +++ b/internal/api/rest.go @@ -16,6 +16,7 @@ import ( "net/http" "os" "path/filepath" + "runtime" "strings" "sync" @@ -184,7 +185,8 @@ type DefaultAPIResponse struct { // handleError writes a standardized JSON error response with the given status code. // It logs the error at WARN level and ensures proper Content-Type headers are set. func handleError(err error, statusCode int, rw http.ResponseWriter) { - cclog.Warnf("REST ERROR : %s", err.Error()) + _, file, line, _ := runtime.Caller(1) + cclog.Warnf("REST ERROR (%s:%d): %s", filepath.Base(file), line, err.Error()) rw.Header().Add("Content-Type", "application/json") rw.WriteHeader(statusCode) if err := json.NewEncoder(rw).Encode(ErrorResponse{