I'm confused about when it's best to handle errors right away and when we
should propagate the error. If error propagation is preferred, does it mean
that we should always define method with return values like (response,
error)? And inside the function, we do something like:

if err := someFunctionCall(); err != nil {
   return nil, err

A more concrete example: I need to create method A that calls B, and inside
B, it uses some HTTP API. should I propagate those http errors to A or just
return nil from B and check if the return value is nil in A.

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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

Discussion Posts

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 2 | next ›
Discussion Overview
groupgolang-nuts @
postedMar 30, '16 at 11:33p
activeMar 31, '16 at 4:25a

2 users in discussion

Hang: 1 post Tamás Gulácsi: 1 post



site design / logo © 2022 Grokbase