|
...
|
...
|
@@ -195,6 +195,10 @@ func parseMultipartForm(r *http.Request) error {
|
|
195
|
195
|
}
|
|
196
|
196
|
|
|
197
|
197
|
func httpError(w http.ResponseWriter, err error) {
|
|
|
198
|
+ if err == nil || w == nil {
|
|
|
199
|
+ logrus.WithFields(logrus.Fields{"error": err, "writer": w}).Error("unexpected HTTP error handling")
|
|
|
200
|
+ return
|
|
|
201
|
+ }
|
|
198
|
202
|
statusCode := http.StatusInternalServerError
|
|
199
|
203
|
// FIXME: this is brittle and should not be necessary.
|
|
200
|
204
|
// If we need to differentiate between different possible error types, we should
|
|
...
|
...
|
@@ -214,10 +218,8 @@ func httpError(w http.ResponseWriter, err error) {
|
|
214
|
214
|
statusCode = http.StatusForbidden
|
|
215
|
215
|
}
|
|
216
|
216
|
|
|
217
|
|
- if err != nil {
|
|
218
|
|
- logrus.Errorf("HTTP Error: statusCode=%d %v", statusCode, err)
|
|
219
|
|
- http.Error(w, err.Error(), statusCode)
|
|
220
|
|
- }
|
|
|
217
|
+ logrus.WithFields(logrus.Fields{"statusCode": statusCode, "err": err}).Error("HTTP Error")
|
|
|
218
|
+ http.Error(w, err.Error(), statusCode)
|
|
221
|
219
|
}
|
|
222
|
220
|
|
|
223
|
221
|
// writeJSONEnv writes the engine.Env values to the http response stream as a
|