2 ms·
Things can still panic in go. Error handling for an API etc usually make the most sense in a central location (some middleware etc) so why would I check that e
by code_runner 4y ago
Things can still panic in go.
Error handling for an API etc usually make the most sense in a central location (some middleware etc) so why would I check that each and every function call was successful.
I do like go, but the error handling is hardly the best thing about it. It’s just different. Neither is wrong.
- usrbinbash 4y ago> Things can still panic in go. Yes, but panics are intended to represent an actually exceptional situation, like dereferencing nil, or the machine running out of memory ... things that normally shouldn't happen, and from which the logic cannot easily recover. > Error handling for an API etc usually make the most sense in a central location ( Which is doable: if err := couldFail(); err != nil { return err } I can let errors bubble up the call stack as far as I want, I just have to be explicit about it.