Skip to content

Commit

Permalink
[opt]: add error msg when json marshal fail (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
stone1100 authored Aug 6, 2024
1 parent 08cfb85 commit 1015589
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/encoding/json.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

0 comments on commit 1015589

Please sign in to comment.