Add log message when we can't marshal JSON
Been seeing this in prod
This commit is contained in:
parent
cb34c43ef4
commit
68e0da1133
1 changed files with 1 additions and 0 deletions
|
|
@ -56,6 +56,7 @@ func authenticatedHandlerJSON[T any](f handlerFunctionGet[T]) http.Handler {
|
|||
}
|
||||
body, err = json.Marshal(resp)
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msg("failed to marshal json")
|
||||
http.Error(w, "{\"message\": \"failed to marshal json\"}", http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue