4 ms·
Semantics. Go at least does not restrict you to wrap every single panicky call. func Foo() { try { maybePanic() } catch (err any) { doSomething(er
by gethly 1y ago
Semantics. Go at least does not restrict you to wrap every single panicky call.
func Foo() {
try {
maybePanic()
} catch (err any) {
doSomething(err)
}
.. more code
}
vs
func Foo() {
defer func() {
if err := recover(); err != nil {
doSomething(err)
}
}()
maybePanic()
.. more code
}