From 10155891597a621e58b2a69ca200d6f193e3fc66 Mon Sep 17 00:00:00 2001 From: stone1100 Date: Tue, 6 Aug 2024 10:53:25 +0800 Subject: [PATCH] [opt]: add error msg when json marshal fail (#11) --- pkg/encoding/json.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/encoding/json.go b/pkg/encoding/json.go index 0242e2c..ca50db7 100644 --- a/pkg/encoding/json.go +++ b/pkg/encoding/json.go @@ -32,12 +32,12 @@ var ( func JSONMarshal(v interface{}) []byte { data, err := json.Marshal(v) if err != nil { - log.Error("json marshal error") + log.Error("json marshal error", logger.Error(err)) } return data } -// JSONUnmarshal parses the JSON-encoded data and stores the result +// JSONUnmarshal parses the JSON-encoded data and stores the result. func JSONUnmarshal(data []byte, v interface{}) error { return json.Unmarshal(data, v) }