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

Unified Diff: deploytool/cmd/luci_deploy/appengine.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 | « deploytool/api/deploy/util.go ('k') | deploytool/cmd/luci_deploy/build.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: deploytool/cmd/luci_deploy/appengine.go
diff --git a/deploytool/cmd/luci_deploy/appengine.go b/deploytool/cmd/luci_deploy/appengine.go
index 6e0e01b1ca58da4a4ca7040a4029a9120dbd8d07..6d8fb608451f63326e720d2ef903001186736441 100644
--- a/deploytool/cmd/luci_deploy/appengine.go
+++ b/deploytool/cmd/luci_deploy/appengine.go
@@ -193,7 +193,7 @@ func gaeBuildAppYAML(aem *deploy.AppEngineModule, staticMap map[*deploy.BuildPat
isStub = true
default:
- return nil, errors.Reason("unsupported runtime %(runtime)q").D("runtime", aem.Runtime).Err()
+ return nil, errors.Reason("unsupported runtime %q", aem.Runtime).Err()
}
// Classic / Managed VM Properties
@@ -232,7 +232,7 @@ func gaeBuildAppYAML(aem *deploy.AppEngineModule, staticMap map[*deploy.BuildPat
icPrefix = "B"
default:
- return nil, errors.Reason("unknown scaling type %(type)T").D("type", sc).Err()
+ return nil, errors.Reason("unknown scaling type %T", sc).Err()
}
appYAML.InstanceClass = p.Classic.InstanceClass.AppYAMLString(icPrefix)
@@ -275,8 +275,8 @@ func gaeBuildAppYAML(aem *deploy.AppEngineModule, staticMap map[*deploy.BuildPat
entry.StaticFiles = filepath.Join(relDir, sf.UrlMap)
default:
- return nil, errors.Reason("don't know how to handle content %(content)T").
- D("content", t).D("url", handler.Url).Err()
+ return nil, errors.Reason("don't know how to handle content %T", t).
+ InternalReason("url(%q)", handler.Url).Err()
}
if entry.Script != "" && isStub {
@@ -338,8 +338,7 @@ func gaeBuildDispatchYAML(cp *layoutDeploymentCloudProject) (*gaeDispatchYAML, e
}
}
if count := len(dispatchYAML.Dispatch); count > 10 {
- return nil, errors.Reason("dispatch file has more than 10 routing rules (%(count)d)").
- D("count", count).Err()
+ return nil, errors.Reason("dispatch file has more than 10 routing rules (%d)", count).Err()
}
return &dispatchYAML, nil
}
@@ -369,7 +368,7 @@ func gaeBuildQueueYAML(cp *layoutDeploymentCloudProject) (*gaeQueueYAML, error)
}
default:
- return nil, errors.Reason("unknown task queue type %(type)T").D("type", t).Err()
+ return nil, errors.Reason("unknown task queue type %T", t).Err()
}
queueYAML.Queue = append(queueYAML.Queue, &entry)
@@ -383,13 +382,12 @@ func gaeBuildQueueYAML(cp *layoutDeploymentCloudProject) (*gaeQueueYAML, error)
func loadIndexYAMLResource(path string) (*deploy.AppEngineResources, error) {
data, err := ioutil.ReadFile(path)
if err != nil {
- return nil, errors.Annotate(err).Reason("failed to load [%(path)s]").D("path", path).Err()
+ return nil, errors.Annotate(err, "failed to load [%s]", path).Err()
}
var indexYAML gaeIndexYAML
if err := yaml.Unmarshal(data, &indexYAML); err != nil {
- return nil, errors.Annotate(err).Reason("could not load 'index.yaml' from [%(path)s]").
- D("path", path).Err()
+ return nil, errors.Annotate(err, "could not load 'index.yaml' from [%s]", path).Err()
}
var res deploy.AppEngineResources
@@ -404,8 +402,8 @@ func loadIndexYAMLResource(path string) (*deploy.AppEngineResources, error) {
for pidx, idxProp := range idx.Properties {
dir, err := deploy.IndexDirectionFromAppYAMLString(idxProp.Direction)
if err != nil {
- return nil, errors.Annotate(err).Reason("could not identify direction for entry").
- D("index", i).D("propertyIndex", pidx).Err()
+ return nil, errors.Annotate(err, "could not identify direction for entry").
+ InternalReason("index(%d)/propertyIndex(%d)", i, pidx).Err()
}
entry.Property[pidx] = &deploy.AppEngineResources_Index_Property{
« no previous file with comments | « deploytool/api/deploy/util.go ('k') | deploytool/cmd/luci_deploy/build.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698