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

Unified Diff: common/errors/annotate_example_test.go

Issue 2958433002: [errors] Remove Fix(), move MultiErrorFromErrors(). (Closed)
Patch Set: keep it secret, keep it safe 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 | « no previous file | common/errors/multierror.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: common/errors/annotate_example_test.go
diff --git a/common/errors/annotate_example_test.go b/common/errors/annotate_example_test.go
index f145a590f23ea99222ae699873e2d414701750f8..58ee286c2b573d2f982751630daf2fec2774669f 100644
--- a/common/errors/annotate_example_test.go
+++ b/common/errors/annotate_example_test.go
@@ -50,8 +50,14 @@ func someIntermediateFunc(vals ...int) error {
defer close(errch)
errch <- Annotate(errorWrapper(someLibFunc(vals...))).Reason("could not process").Err()
}()
- if err := MultiErrorFromErrors(errch); err != nil {
- return Annotate(err).Reason("while processing %(vals)v").D("vals", vals).Err()
+ me := MultiError(nil)
+ for err := range errch {
+ if err != nil {
+ me = append(me, err)
+ }
+ }
+ if me != nil {
+ return Annotate(me).Reason("while processing %(vals)v").D("vals", vals).Err()
}
return nil
}
@@ -102,11 +108,11 @@ func ExampleAnnotate() {
// ... skipped SOME frames in pkg "runtime"...
//
// GOROUTINE LINE
- // #? github.com/luci/luci-go/common/errors/annotate_example_test.go:54 - errors.someIntermediateFunc()
+ // #? github.com/luci/luci-go/common/errors/annotate_example_test.go:60 - errors.someIntermediateFunc()
// reason: "while processing [3]"
// "vals" = []int{3}
//
- // #? github.com/luci/luci-go/common/errors/annotate_example_test.go:60 - errors.ExampleAnnotate()
+ // #? github.com/luci/luci-go/common/errors/annotate_example_test.go:66 - errors.ExampleAnnotate()
// reason: "top level"
//
// #? testing/example.go:XXX - testing.runExample()
@@ -114,5 +120,4 @@ func ExampleAnnotate() {
// #? testing/testing.go:XXX - testing.(*M).Run()
// ... skipped SOME frames in pkg "_test"...
// ... skipped SOME frames in pkg "runtime"...
-
}
« no previous file with comments | « no previous file | common/errors/multierror.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698