Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(64)

Unified Diff: go/httputils/http.go

Issue 1820863002: Update callers of httputils.ReportError to specify message (Closed) Base URL: https://skia.googlesource.com/buildbot@master
Patch Set: Remove taskID Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « datahopper_internal/go/datahopper_internal/main.go ('k') | push/go/push/main.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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)
}
}
« no previous file with comments | « datahopper_internal/go/datahopper_internal/main.go ('k') | push/go/push/main.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698