Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple error handling #5

Open
YoungFaithful opened this issue Mar 2, 2021 · 1 comment
Open

Multiple error handling #5

YoungFaithful opened this issue Mar 2, 2021 · 1 comment

Comments

@YoungFaithful
Copy link
Contributor

Multiple error handling of a spawned task is currently sub optimal:

  • The first error returns a failed task, but breaks the WorkerUtilities
  • The second error is just a runnable task.
    How could we assign the error to the task and finish the task?
julia -t 2
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.5.3 (2020-11-09)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

julia> using WorkerUtilities

julia> WorkerUtilities.init()

julia> resp = WorkerUtilities.@spawn(sqrt(-1))
Task (failed) @0x00007f96267c5120
DomainError with -1.0:
sqrt will only return a complex result if called with a complex argument. Try sqrt(Complex(x)).
throw_complex_domainerror(::Symbol, ::Float64) at ./math.jl:33
sqrt at ./math.jl:573 [inlined]
sqrt(::Int64) at ./math.jl:599
(::var"#1#2")() at ./task.jl:112

julia> resp
Task (failed) @0x00007f96267c5120
DomainError with -1.0:
sqrt will only return a complex result if called with a complex argument. Try sqrt(Complex(x)).
throw_complex_domainerror(::Symbol, ::Float64) at ./math.jl:33
sqrt at ./math.jl:573 [inlined]
sqrt(::Int64) at ./math.jl:599
(::var"#1#2")() at ./task.jl:112

julia> resp = WorkerUtilities.@spawn(sqrt(-2))
# Takes forever...
@YoungFaithful
Copy link
Contributor Author

It helps to rerun WorkerUtilities.init() when an error occurs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant