How do I see errors encountered in async coroutines/tasks?

or – after rereading your question :slightly_smiling_face:

function f()
	try
    	wait(Timer(1))
		undeclaredvar
	catch exc
		println(stacktrace())
		println(exc)
	end
end

function g()
	@async f()
	nothing
end

julia> g()

julia> Base.StackTraces.StackFrame[f() at test.jl:7, (::var"#11#12")() at task.jl:358]
UndefVarError(:undeclaredvar)
julia> 

julia>
1 Like