So put each on a newline?
On Saturday, February 4, 2017 at 12:17:45 AM UTC-8, Sander van Harmelen wrote: > > Did you check the errors package: https://godoc.org/github.com/pkg/errors > <https://godoc.org/github.com/pkg/errors#example-Errorf--Extended> ? > > It offers a great way to wrap chained errors. > > Sander > > On 4 Feb 2017, at 09:08, so.q...@gmail.com <javascript:> wrote: > > > Is there a idiomatic recommendation for generally displaying errors > resulting from chained methods? > > The following would print out "ERROR: Foo() ERROR: Bar() ERROR: > stdlib.Func() something went wrong with this standard function call", which > feels obviously wrong. > > > > > func main() { > if err := Foo(); err != nil { > fmt.Printf("ERROR: Foo() %s", err) > os.Exit(1) > } > } > > func Foo() error { > if err := Bar(); err { > return fmt.Errorf("ERROR: Bar() %s", err) > } > return nil > } > > > func Bar() error { > if err := stdlib.Func(); err != nil { > return fmt.Errorf("ERROR: stdlib.Func() %s", err) > } > return nil > } > > > > -- > You received this message because you are subscribed to the Google Groups > "golang-nuts" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to golang-nuts...@googlegroups.com <javascript:>. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.