Skip to content

Commit

Permalink
add debug for all errors
Browse files Browse the repository at this point in the history
  • Loading branch information
devbugging committed Sep 6, 2024
1 parent 04ba8f7 commit 031a7cd
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions api/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,12 @@ func (w *responseHandler) Write(data []byte) (int, error) {
if message.Error == nil {
r, _ := message.Result.MarshalJSON()
log.RawJSON("result", r).Msg("API response")
} else { // still debug output all errors even known ones
l.Debug().
Str("error", message.Error.Message).
Int("code", message.Error.Code).
Any("data", message.Error.Data).
Msg("API error response")
}

return w.ResponseWriter.Write(data)
Expand Down

0 comments on commit 031a7cd

Please sign in to comment.