Closed stevenpelley closed 10 months ago
That makes sense! I also saw a recent article on return traces, and they seem like a nice solution.
The doc changes make sense to me, and if you think there needs to be more support for that, I'm interested in hearing what you think it looks like
I'll submit a pull request when I get a chance.
We must have seen the same HN article on return traces. I like the concept as a goal of error handling, at least for errors that may be handled as internal errors and need enough information to debug, but I think a framework to do it is a little too magical.
Wrap() does one of four things depending on its input "e":
(3) and (4) are clearly stated in the doc. I think it's fair to say that (1) is implicit.
(2) is not documented, and this has implications for Wrap's use. In many cases I want it to do (2), but in some cases I want to additionally wrap with a new stack trace:
All of this applies to WrapPrefix() as well.
I recommend changing the doc from:
to:
I'm happy to write the PR but I wanted to discuss first.