3 ms·
I don't even notice the `if err != nil` anymore. Is there a more elegant way to handle errors in a concurrent language than returning error values? In general,
by mmgutz 10y ago
I don't even notice the `if err != nil` anymore.
Is there a more elegant way to handle errors in a concurrent language than returning error values? In general, exceptions do not work well within async programming. Too many JavaScript developers use exceptions and I advise to return errors instead. At least Go is consistent.
- pcwalton 10y ago> In general, exceptions do not work well within async programming. Exceptions do work well with synchronous programming, which is Go's model.
- asdfaoeu 10y agoExceptions work fine in languages like Python with tornado gen coroutine. It depends whether the language as proper support for async functions.
- weberc2 10y agoExceptions don't work fine in Python for single-threaded apps. Everything throws, and almost nothing catches. User provided malformed JSON? Hit 'em with an HTTP 500.
- roxma 10y ago+1 for being consistent!