Closed yard closed 1 year ago
Firstly, can you run the code you proposed and add the output to this issue.
I was hoping you'd come back, but in any case, if you ran the code, you'd see it would log the errors.
Regarding your specific question:
Could you please elaborate on the reason why StandardErrors are not propagated up to the parent, whereas Exceptions do?
Because StandardErrors are errors you can do something about and are propagated out of the task (promise) when calling wait. But Exceptions (like memory allocation failure) is generally not something you can do anything about, and thus it will kill the reactor.
Hey guys,
Found a slightly unsettling piece of code within the library located at https://github.com/socketry/async/blob/main/lib/async/task.rb#L248
Could you please elaborate on the reason why
StandardError
s are not propagated up to the parent, whereasException
s do?While seemingly insignificant at first glance, it makes certain things less convenient. Consider the following code:
Once this is written like that, there is no way to understand that an inner task failed without explicitly tracking its status (e.g. storing it into a variable and querying it later), which appears to be a contradiction with the comment of
fail!
function suggesting "If the user writes code which raises an exception, that exception should always be visible".Many thanks in advance!