It boils down to the user of a specific function that either : * wants to ignore the error if there is any, and let the error bubble up the call stack without manual code for it * want to handle the error in case it happens because this is significant to the code
Why not something like a function out parameter or return value of type ErrorCode that the caller has the option to either ignore, in which case the error would be propagated automatically, or to use and act on it, in which case the error is handled by the caller and not propagated. This different than the `try ... except` syntax because `try` would catch any exception thrown by the code within whereas the out parameter could propagate only some errors the inner function chose to make available while still keeping the ability to throw unrelated exceptions. proc perform_some_request(args: Args, err: var ErrorCode) = let req = newRequest(args) # allocation could fail and will throw req.perform(err) # request could fail but the error is nicely propagated to the parent try: var err ErrorCode perform_some_request(args, err) if err: # the request could not complete, do something reasonable for it except: # there is an unrecoverable error, log it and exit Run If the error argument is not provided, then the exception is thrown. Of course if the ErrorCode is just an int, the message and stack trace and context would be accessible via local storage transparently.