Skip to content

Go2ErrorHandlingFeedback

Feedback re Go 2 Error Handling Draft Design

This page is meant to collect and organize feedback and discussion started with the Go 2 error handling draft design.

Please post feedback on your blog, Medium, GitHub Gists, mailing lists, Google Docs, etc. And then please link it here.

Please help categorize the rest of the uncategorized proposals at the bottom.

Update, June 19, 2019 – Based on this feedback we have posted a proposal for a try builtin, which produced significant feedback on #32437 (threaded view here).

We've disabled comments on that issue until July 1 to give people time to experiment in their own code. We would very much like to see experience reports about using the general try approach in your own code, including trial conversions with tryhard. Thanks!

Experience with the “try proposal”

Add to this list:

  • TEMPLATE: Your Name, “Title”, Month YYYY

Requirements

Discussions of the requirements for a new error handling method.

In support

This includes supporting the existing chaining/stacking of handlers without changes.

Example code

Code changed to use the existing proposal.

Against

Critiques without counter-proposals

Recurring themes

Concepts that appear repeatedly among the suggestions below.

  • Invoke handler via assignment, e.g. v, ? := f()
    references: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14

  • Invoke one of several handlers by name, e.g. v := check f() ? name
    references: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17

Modest revisions

Remove handler chaining

Counter-proposals

Error handling with normal functions

Labeled error handlers

Inlining

Use defer

try/catch/finally syntax

Other possibilities

Uncategorized

Please help categorize the rest of the proposals here.

Adding your feedback

Please format all entries as below.

  • Your Name, “Title”, month year

To make it easier to see new feedback, please add your new proposal to the top of the section it is placed in.