go error handling proposals

overview of error handling proposals in go

SEAN K.H. LIAO

go error handling proposals

overview of error handling proposals in go

note: updated 12023-11-17

error handling

1if err != nil {
2        // handle error
3}

Error handling seems to be a recurring theme in go, but most proposals get nowhere.

proposals

baseline code

1x, err := foo()
2if err != nil {
3        return nil, wrap(err)
4}
handling

note: almost all the ones that claim to use "plain functions" as error handlers have an implicit nonlocal return

predeclared handlers
call specific handler
wrapping

some rely on wrap being smart and passing through nil (so not fmt.Errorf),

return
try..catch
others