File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4848 complete picture. Note that 'finally' blocks will never be recorded
4949 (unless of course they raise a new error!), since they are functions that
5050 return normally.
51+
52+ A note about use cases: while `try` should be familiar and comfortable
53+ to users of exceptions in other languages, and we feel use of a "typed"
54+ panic mechanism results in effective error handling with a minimization
55+ of boilerplate checking error return codes... `try` and `panic` are not
56+ always the correct answer! There are at least two situations where you
57+ may want to consider converting back to handling errors as regular values:
58+ If passing errors between goroutines, of course you need to pass them
59+ as values. Another situation where error returns are more capable than
60+ panics is when part of multiple-returns, where the other values may have
61+ been partially assembled and still may need be subject to cleanup by the
62+ caller. Fortunately, you can always use `CatchAll` to easily fence a block
63+ of panic-oriented code and convert it into errors-by-value flow.
5164*/
5265package try
5366
You can’t perform that action at this time.
0 commit comments