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

Unified Diff: milo/build_source/swarming/buildinfo.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 | « milo/build_source/swarming/build.go ('k') | tokenserver/appengine/impl/certconfig/rpc_fetch_crl.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: milo/build_source/swarming/buildinfo.go
diff --git a/milo/build_source/swarming/buildinfo.go b/milo/build_source/swarming/buildinfo.go
index 0f7361de3a18bfe998d54bbd1ca2c77006ae16bd..795c1bbc4eabe933fffda2c9d0544e60c9973804 100644
--- a/milo/build_source/swarming/buildinfo.go
+++ b/milo/build_source/swarming/buildinfo.go
@@ -220,26 +220,23 @@ func resolveLogDogStreamAddrFromTags(tags map[string]string, taskID string, tryN
// Gather our Swarming task template parameters and perform a substitution.
runID, err := getRunID(taskID, tryNumber)
if err != nil {
- return nil, errors.Annotate(err).Err()
+ return nil, errors.Annotate(err, "").Err()
}
p := tasktemplate.Params{
SwarmingRunID: runID,
}
if logLocation, err = p.Resolve(logLocation); err != nil {
- return nil, errors.Annotate(err).Reason("failed to resolve swarming task templating in 'log_location'").Err()
+ return nil, errors.Annotate(err, "failed to resolve swarming task templating in 'log_location'").Err()
}
addr, err := types.ParseURL(logLocation)
if err != nil {
- return nil, errors.Annotate(err).Reason("could not parse LogDog stream from location").Err()
+ return nil, errors.Annotate(err, "could not parse LogDog stream from location").Err()
}
// The LogDog stream's project should match the LUCI project.
if string(addr.Project) != luciProject {
- return nil, errors.Reason("stream project %(streamProject)q doesn't match LUCI project %(luciProject)q").
- D("luciProject", luciProject).
- D("streamProject", addr.Project).
- Err()
+ return nil, errors.Reason("stream project %q doesn't match LUCI project %q", addr.Project, luciProject).Err()
}
return addr, nil
@@ -259,17 +256,13 @@ func getRunID(taskID string, tryNumber int64) (string, error) {
// Parse "tryNumber" as a hex string.
if tryNumber < 0 || tryNumber > 0x0F {
- return "", errors.Reason("try number %(try)d exceeds 4 bits").
- D("try", tryNumber).
- Err()
+ return "", errors.Reason("try number %d exceeds 4 bits", tryNumber).Err()
}
lastChar, lastCharSize := utf8.DecodeLastRuneInString(taskID)
v, err := strconv.ParseUint(string(lastChar), 16, 8)
if err != nil {
- return "", errors.Annotate(err).Reason("failed to parse hex from rune: %(rune)r").
- D("rune", lastChar).
- Err()
+ return "", errors.Annotate(err, "failed to parse hex from rune: %r", lastChar).Err()
}
return taskID[:len(taskID)-lastCharSize] + strconv.FormatUint((v|uint64(tryNumber)), 16), nil
« no previous file with comments | « milo/build_source/swarming/build.go ('k') | tokenserver/appengine/impl/certconfig/rpc_fetch_crl.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698