| Index: go/httputils/http.go
|
| diff --git a/go/httputils/http.go b/go/httputils/http.go
|
| index 6a1ba310464dcdde753f4f479a4d07e8ab5df4ff..738854e441058d0652c4e36a24824d9bc4e23c2c 100644
|
| --- a/go/httputils/http.go
|
| +++ b/go/httputils/http.go
|
| @@ -168,10 +168,16 @@ func (t *BackOffTransport) RoundTrip(req *http.Request) (*http.Response, error)
|
| // be also useful if we could specify a return status explicitly.
|
|
|
| // ReportError formats an HTTP error response and also logs the detailed error message.
|
| +// The message parameter is returned in the HTTP response. If it is not provided then
|
| +// "Unknown error" will be returned instead.
|
| func ReportError(w http.ResponseWriter, r *http.Request, err error, message string) {
|
| glog.Errorln(message, err)
|
| if err != io.ErrClosedPipe {
|
| - http.Error(w, message, 500)
|
| + httpErrMsg := message
|
| + if message == "" {
|
| + httpErrMsg = "Unknown error"
|
| + }
|
| + http.Error(w, httpErrMsg, 500)
|
| }
|
| }
|
|
|
|
|