defradb
defradb copied to clipboard
Fix StatusBadRequest -> StatusInternalServerError for internal errors in http handler
Suggestion from @nasdf: https://github.com/sourcenetwork/defradb/pull/3099#discussion_r1787947741
Change:
db, ok := req.Context().Value(dbContextKey).(client.DB)
if !ok {
responseJSON(rw, http.StatusBadRequest, errorResponse{NewErrFailedToGetContext("db")})
return
}
To return error 500
so roughly this:
db, ok := req.Context().Value(dbContextKey).(client.DB)
if !ok {
responseJSON(rw, http.StatusInternalServerError, errorResponse{NewErrFailedToGetContext("db")})
return
}