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

Unified Diff: milo/appengine/logdog/http.go

Issue 2717623002: Milo: Handle missing / transient LogDog failures. (Closed)
Patch Set: remote unnecessary code Created 3 years, 10 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 | « milo/appengine/logdog/build.go ('k') | milo/appengine/swarming/build.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: milo/appengine/logdog/http.go
diff --git a/milo/appengine/logdog/http.go b/milo/appengine/logdog/http.go
index 43190b9074cec535178ce247f70b67646da313e2..906d39bed388ff42ad3c01542267bd478d08d3aa 100644
--- a/milo/appengine/logdog/http.go
+++ b/milo/appengine/logdog/http.go
@@ -61,7 +61,25 @@ func (s *AnnotationStreamHandler) Render(c context.Context, req *http.Request, p
// Load the Milo annotation protobuf from the annotation stream.
if _, err := as.Fetch(c); err != nil {
- return nil, err
+ switch errors.Unwrap(err) {
+ case coordinator.ErrNoSuchStream:
+ return nil, &miloerror.Error{
+ Message: "Stream does not exist",
+ Code: http.StatusNotFound,
+ }
+
+ case coordinator.ErrNoAccess:
+ return nil, &miloerror.Error{
+ Message: "No access to stream",
+ Code: http.StatusForbidden,
+ }
+
+ default:
+ return nil, &miloerror.Error{
+ Message: "Failed to load stream",
+ Code: http.StatusInternalServerError,
+ }
+ }
}
// Convert the Milo Annotation protobuf to Milo objects.
« no previous file with comments | « milo/appengine/logdog/build.go ('k') | milo/appengine/swarming/build.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698