How to print exceptions with multiple @async tasks

Say I have two @async long-running tasks. How can I know if one of them throws an exception?

For example, no error message is ever printed from

@sync begin
 @async error()
 @async while true
  sleep(1)
 end
end

EDIT:
The solution is to use Base.Experimental.@sync, which returns early on any exceptions.

1 Like