Merge branch 'master' into neilalexander/pprof

This commit is contained in:
Neil Alexander 2020-05-11 14:04:03 +01:00 committed by GitHub
commit 9eb19f329b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View file

@ -118,7 +118,10 @@ func Download(
)
if err != nil {
// TODO: Handle the fact we might have started writing the response
dReq.jsonErrorResponse(w, util.ErrorResponse(err))
dReq.jsonErrorResponse(w, util.JSONResponse{
Code: http.StatusNotFound,
JSON: jsonerror.NotFound("Failed to download: " + err.Error()),
})
return
}
@ -138,7 +141,7 @@ func (r *downloadRequest) jsonErrorResponse(w http.ResponseWriter, res util.JSON
if err != nil {
r.Logger.WithError(err).Error("Failed to marshal JSONResponse")
// this should never fail to be marshalled so drop err to the floor
res = util.MessageResponse(http.StatusInternalServerError, "Internal Server Error")
res = util.MessageResponse(http.StatusNotFound, "Download request failed: "+err.Error())
resBytes, _ = json.Marshal(res.JSON)
}

View file

@ -264,3 +264,4 @@ User can invite local user to room with version 5
remote user can join room with version 5
User can invite remote user to room with version 5
Remote user can backfill in a room with version 5
Alternative server names do not cause a routing loop