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

Unified Diff: dm/appengine/deps/ensure_graph_data.go

Issue 2963503003: [errors] Greatly simplify common/errors package. (Closed)
Patch Set: fix nits Created 3 years, 6 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 | « dm/appengine/deps/auth.go ('k') | dm/appengine/deps/service.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dm/appengine/deps/ensure_graph_data.go
diff --git a/dm/appengine/deps/ensure_graph_data.go b/dm/appengine/deps/ensure_graph_data.go
index bc567b6e598434ac988abcefebcb6926395ba248..38f497685db4453d4e4e217af5371409ed7deafd 100644
--- a/dm/appengine/deps/ensure_graph_data.go
+++ b/dm/appengine/deps/ensure_graph_data.go
@@ -143,8 +143,7 @@ func journalQuestAttempts(c context.Context, newQuests []*model.Quest, newAttemp
DoNotMergeQuest: true,
})
}
- return grpcAnnotate(tumble.AddToJournal(c, muts...), codes.Internal).
- Reason("attempting to journal").Err()
+ return grpcAnnotate(tumble.AddToJournal(c, muts...), codes.Internal, "attempting to journal").Err()
}
func (d *deps) ensureGraphData(c context.Context, req *dm.EnsureGraphDataReq, newQuests []*model.Quest, newAttempts *dm.AttemptList, rsp *dm.EnsureGraphDataRsp) (err error) {
@@ -176,7 +175,7 @@ func (d *deps) ensureGraphData(c context.Context, req *dm.EnsureGraphDataReq, ne
}
})
if err != nil {
- return grpcAnnotate(err, codes.Internal).Reason("failed to gather prerequisites").Err()
+ return grpcAnnotate(err, codes.Internal, "failed to gather prerequisites").Err()
}
// Now that we've walked the graph, prune the lists of new Quest and Attempts
@@ -185,7 +184,7 @@ func (d *deps) ensureGraphData(c context.Context, req *dm.EnsureGraphDataReq, ne
newQuests, newQuestSet := filterQuestsByNewTemplateData(rsp.Result, newQuests)
newAttempts, newAttemptsLen, err := filterAttemptsByDNE(rsp.Result, newAttempts, newQuestSet)
if err != nil {
- return grpcAnnotate(err, codes.InvalidArgument).Reason("filterAttemptsByDNE").Err()
+ return grpcAnnotate(err, codes.InvalidArgument, "filterAttemptsByDNE").Err()
}
// we're just asserting nodes, no edges, so journal whatever's left
@@ -299,8 +298,8 @@ func renderRequest(c context.Context, req *dm.EnsureGraphDataReq) (rsp *dm.Ensur
}
if err = d.Validate(qDesc.DistributorParameters); err != nil {
- err = grpcAnnotate(err, codes.InvalidArgument).
- Reason("JSON distributor parameters are invalid for this distributor configuration.").Err()
+ err = grpcAnnotate(err, codes.InvalidArgument,
+ "JSON distributor parameters are invalid for this distributor configuration.").Err()
return
}
@@ -368,7 +367,7 @@ func (d *deps) EnsureGraphData(c context.Context, req *dm.EnsureGraphDataReq) (r
logging.Fields{"execution": req.ForExecution.Id}.Infof(c, "on behalf of")
_, _, err := model.AuthenticateExecution(c, req.ForExecution)
if err != nil {
- return nil, grpcAnnotate(err, codes.Unauthenticated).Reason("bad execution auth").Err()
+ return nil, grpcAnnotate(err, codes.Unauthenticated, "bad execution auth").Err()
}
} else {
if err = canWrite(c); err != nil {
« no previous file with comments | « dm/appengine/deps/auth.go ('k') | dm/appengine/deps/service.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698