Skip to content

Commit

Permalink
Merge pull request #18 from Moranilt/feature/err-code-in-logs
Browse files Browse the repository at this point in the history
feat: add error code into logs
  • Loading branch information
Moranilt committed Apr 3, 2024
2 parents 895d10e + 7ec6a1f commit 1883333
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions handler/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -282,14 +282,14 @@ func (h *HandlerMaker[ReqT, RespT]) WithMultipart(maxMemory int64) *HandlerMaker
func (h *HandlerMaker[ReqT, RespT]) Run(successStatus int) {
h.logger.With("body", h.requestBody).Info("request")
if h.err != nil {
h.logger.Error(h.err.Error(), "details", h.err.GetDetails())
h.logger.Error(h.err.Error(), "code", h.err.GetCode(), "details", h.err.GetDetails())
response.ErrorResponse(h.response, h.err, http.StatusBadRequest)
return
}

resp, err := h.caller(h.request.Context(), h.requestBody)
if err != nil {
h.logger.Error(err.Error(), "details", err.GetDetails())
h.logger.Error(err.Error(), "code", err.GetCode(), "details", err.GetDetails())
response.ErrorResponse(h.response, err, err.GetHTTPStatus())
return
}
Expand Down

0 comments on commit 1883333

Please sign in to comment.