3 ms·
I like having errors and handling them explicitly, though it's a very common pattern to do something, and if there's an error, bubble the error up. I think ins
by mortallywounded 3y ago
I like having errors and handling them explicitly, though it's a very common pattern to do something, and if there's an error, bubble the error up.
I think instead of a bang it would be better to have a keyword like this.. similar to defer to defer a function. Maybe `try` to give a function a try and if any error is returned then bubble up.
defer cleanup()
bar := try somethingelse() // equal to bar, err := somethingelse()
.. return err