Add log message when we can't marshal JSON

Been seeing this in prod
This commit is contained in:
Eli Ribble 2026-03-20 05:01:52 +00:00
parent cb34c43ef4
commit 68e0da1133
No known key found for this signature in database

View file

@ -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
}