From 695b48ae91786e1e44c9124edc2ad8ba58e79919 Mon Sep 17 00:00:00 2001 From: mstar Date: Thu, 24 Apr 2025 15:58:21 +0200 Subject: [PATCH] More error returns added --- http/json.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/http/json.go b/http/json.go index ac6e4ae..b3a9424 100644 --- a/http/json.go +++ b/http/json.go @@ -4,14 +4,17 @@ import ( "encoding/json" "fmt" "net/http" + + "git.mstar.dev/mstar/goutils/other" ) func SendJson(w http.ResponseWriter, data any) error { encoded, err := json.Marshal(data) if err != nil { - return err + return other.Error("webutils.SendJson", "failed to marshal data to json", err) } w.Header().Add("Content-Type", "application/json") - fmt.Fprint(w, string(encoded)) + // Can't really catch here + _, _ = fmt.Fprint(w, string(encoded)) return nil }