3 ms·
Java, C#, Python, Lisp, and Erlang would all criticize Go for an unqualified new exception system panic/recover is not an exception system in the sense th
by redbad 14y ago
Java, C#, Python, Lisp, and Erlang would all criticize
Go for an unqualified new exception system
panic/recover is not an exception system in the sense that you mean. Nobody is writing large applications and using panic/recover for error handling. (At least, I hope not!) The idiomatic way of handling errors in Go is returning them explicitly, and checking for them at the call site.
func canFail() (int, error) { ... }
value, err := canFail()
if err != nil {
// handle
}