I'm not quite sure what you mean by this. Swift error handling isn't done by stack unwinding, so we don't actually know where the error was originally raised.
I'm honestly not certain what the correct behaviour here is; clearly if you throw
an error from main, there's nothing to catch it and today that means you've crashed. There's no way in an error to specify an exit code, so it can't really be any kind of "clean" exit right now. On the other hand, using exit()
from the C library to terminate the program is awkward in other ways (as mentioned in the aforementioned discussion from last year, which I'm reading as I write this).
It seems to me that this is more of a language design issue rather than a runtime issue per se, and that there probably should be a more Swift-y way to exit with an error code.