This commit is contained in:
Vicente Ferrari Smith 2026-05-20 07:54:07 +02:00
parent 2900582eb4
commit f77bcb3772

View File

@ -136,5 +136,11 @@ func (app *Application) LogError(r *http.Request, err error) {
if buf, ok := r.Context().Value(RequestBodyKey).(*bytes.Buffer); ok && buf.Len() > 0 { if buf, ok := r.Context().Value(RequestBodyKey).(*bytes.Buffer); ok && buf.Len() > 0 {
props["request_body"] = buf.String() props["request_body"] = buf.String()
} }
var apiErr *data.Error
if errors.As(err, &apiErr) {
for k, v := range apiErr.Details {
props[k] = v
}
}
app.Logger.PrintError(err, props) app.Logger.PrintError(err, props)
} }