I don't think that specific line of code you linked is problematic, consider 
the same code with synchronous sockets: the exception would bubble up until a 
point where it's caught where you'd have access to the socket and would then 
close it (or preferably have a `defer` set up to close it). If you were running 
the function in a new thread then you'd be expected to handle the resource 
clean up yourself. If there is an [unhandled exception in a thread then your 
whole application will 
fail](https://nim-lang.org/docs/threads.html#onThreadDestruction%2Cproc%29).

This is the same with async, when you call `asyncCheck` you're asking for your 
process to crash when the async proc you run throws an exception. All 
`asyncCheck` does is set a callback to do that. Ideally it shouldn't be 
necessary to have this `asyncCheck` written all over the place, but when I 
implemented async/await it wasn't trivial to do this implicitly.

Reply via email to