File tree Expand file tree Collapse file tree 3 files changed +12
-6
lines changed Expand file tree Collapse file tree 3 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -84,6 +84,7 @@ function Base.copy(t::Task)
84
84
end
85
85
86
86
struct CTaskException
87
+ etype
87
88
msg:: String
88
89
backtrace:: Vector{Union{Ptr{Nothing}, Base.InterpreterIP}}
89
90
end
@@ -191,7 +192,12 @@ consume(p::Task, values...) = begin
191
192
return p. result
192
193
end
193
194
if p. exception != nothing
194
- throw (CTaskException (p. exception. msg, p. backtrace))
195
+ msg = if :msg in fieldnames (typeof (p. exception))
196
+ p. exception. msg
197
+ else
198
+ string (typeof (p. exception))
199
+ end
200
+ throw (CTaskException (typeof (p. exception), msg, p. backtrace))
195
201
end
196
202
end
197
203
wait ()
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ r = @testset "Broken Functions Tests" begin
17
17
try
18
18
consume (t)
19
19
catch ex
20
- @test isa (ex, ErrorException)
20
+ @test ex . etype == ErrorException
21
21
end
22
22
@test isa (t. exception, ErrorException)
23
23
end
@@ -37,7 +37,7 @@ r = @testset "Broken Functions Tests" begin
37
37
try
38
38
consume (t)
39
39
catch ex
40
- @test isa (ex, BoundsError)
40
+ @test ex . etype == BoundsError
41
41
end
42
42
@test isa (t. exception, BoundsError)
43
43
end
@@ -58,7 +58,7 @@ r = @testset "Broken Functions Tests" begin
58
58
try
59
59
consume (t)
60
60
catch ex
61
- @test isa (ex, BoundsError)
61
+ @test ex . etype == BoundsError
62
62
end
63
63
@test isa (t. exception, BoundsError)
64
64
end
@@ -80,7 +80,7 @@ r = @testset "Broken Functions Tests" begin
80
80
try
81
81
consume (t_copy)
82
82
catch ex
83
- @test isa (ex, BoundsError)
83
+ @test ex . etype == BoundsError
84
84
end
85
85
@test isa (t_copy. exception, BoundsError)
86
86
end
Original file line number Diff line number Diff line change @@ -56,4 +56,4 @@ function g_break()
56
56
end
57
57
58
58
t = CTask (g_break)
59
- @test_throws MethodError consume (t)
59
+ @test_throws Libtask . CTaskException consume (t)
You can’t perform that action at this time.
0 commit comments