# How to print exceptions with multiple @async tasks

**URL:** <https://discourse.julialang.org/t/how-to-print-exceptions-with-multiple-async-tasks/43992>\
**Category:** General Usage\
**Created:** [July 30, 2020, 4:56pm UTC](https://discourse.julialang.org/t/how-to-print-exceptions-with-multiple-async-tasks/43992 "2020-07-30T16:56:34Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![robsmith11](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/robsmith11/32/29641_2.png) [@robsmith11](https://discourse.julialang.org/u/robsmith11)\
**Post date:** [July 30, 2020, 4:56pm UTC](https://discourse.julialang.org/t/how-to-print-exceptions-with-multiple-async-tasks/43992/1 "2020-07-30T16:56:34Z")

</div>

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

```julia
@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.
