Closed
Description
openedon Aug 6, 2015
Working with exceptions in the presence of tasks can be a little frustrating. Two concrete issues I encountered:
julia> t = @schedule try
while true; sleep(1); end
catch e
isa(e,InterruptException) || rethrow(e)
end
Task (waiting) @0x00000001116c6cb0
julia> try
error("You will never see me")
catch e
rethrow(e)
finally
Base.throwto(t,InterruptException)
end
ERROR: InterruptException
in throwto at ./task.jl:29
in anonymous at ./no file:6
This is because exception in transit is not task local.
The other problem is that stack traces are pretty bad when wait
ing on a task:
julia> foo() = error("Foo")
foo (generic function with 1 method)
julia> foo()
ERROR: Foo
in foo at ./none:1
julia> wait(@schedule foo())
ERROR: Foo
in yieldto at ./task.jl:24
in wait at ./task.jl:313
in wait at ./task.jl:228
in wait at ./task.jl:61
The backtrace from the task is not shown anywhere. Ideally it would be displayed somehow.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment