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

Unified Diff: vpython/python/find.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 | « vpython/options.go ('k') | vpython/python/interpreter.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: vpython/python/find.go
diff --git a/vpython/python/find.go b/vpython/python/find.go
index e9c0f2733eb3bf827a5c15365d2e424287ee4757..8f8451bae435e4b5f882c03b3cfdff256796a006 100644
--- a/vpython/python/find.go
+++ b/vpython/python/find.go
@@ -69,7 +69,7 @@ func Find(c context.Context, vers Version, lookPath LookPathFunc) (*Interpreter,
}
// No Python interpreter could be identified.
- return nil, errors.Annotate(lookErrs.Get()).Reason("no Python found").Err()
+ return nil, errors.Annotate(lookErrs.Get(), "no Python found").Err()
}
func findInterpreter(c context.Context, name string, vers Version, lookPath LookPathFunc) (*Interpreter, error) {
@@ -78,9 +78,7 @@ func findInterpreter(c context.Context, name string, vers Version, lookPath Look
}
lpr, err := lookPath(c, name)
if err != nil {
- return nil, errors.Annotate(err).Reason("could not find executable for: %(name)q").
- D("name", name).
- Err()
+ return nil, errors.Annotate(err, "could not find executable for: %q", name).Err()
}
i := Interpreter{
@@ -102,16 +100,10 @@ func findInterpreter(c context.Context, name string, vers Version, lookPath Look
iv, err := i.GetVersion(c)
if err != nil {
- return nil, errors.Annotate(err).Reason("failed to get version for: %(interp)q").
- D("interp", i.Python).
- Err()
+ return nil, errors.Annotate(err, "failed to get version for: %q", i.Python).Err()
}
if !vers.IsSatisfiedBy(iv) {
- return nil, errors.Reason("interpreter %(interp)q version %(interpVersion)q does not satisfy %(version)q").
- D("interp", i.Python).
- D("interpVersion", iv).
- D("version", vers).
- Err()
+ return nil, errors.Reason("interpreter %q version %q does not satisfy %q", i.Python, iv, vers).Err()
}
return &i, nil
« no previous file with comments | « vpython/options.go ('k') | vpython/python/interpreter.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698