defradb icon indicating copy to clipboard operation
defradb copied to clipboard

Fix StatusBadRequest -> StatusInternalServerError for internal errors in http handler

Open shahzadlone opened this issue 4 months ago • 0 comments

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
	}

shahzadlone avatar Oct 04 '24 20:10 shahzadlone