Skip to content

Commit 0c54030

Browse files
v1.1.0; better error message
1 parent b0a75c7 commit 0c54030

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

Project.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "RobustPmap"
22
uuid = "27aeedcb-f738-516b-a0b8-3211cf1146e5"
3-
version = "1.0.2"
3+
version = "1.1.0"
44

55
[deps]
66
Distributed = "8ba89e20-285c-5b6f-9357-94700520ee1b"
@@ -9,8 +9,8 @@ JLD2 = "033835bb-8acc-5ee8-8aae-3f567f8a3819"
99

1010
[compat]
1111
FileIO = "1"
12-
JLD2 = "0.2, 0.3, 0.4, 0.5"
13-
julia = "1.5"
12+
JLD2 = "0.4, 0.5, 1"
13+
julia = "1.10"
1414

1515
[extras]
1616
Distributed = "8ba89e20-285c-5b6f-9357-94700520ee1b"

src/RobustPmap.jl

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,17 @@ import Distributed
3636
import JLD2
3737
import FileIO
3838

39-
"Check for type exceptions"
40-
function checkexceptions(x::Any, t::Type=Any)
39+
"Check for exceptions"
40+
function checkexceptions(x::Any, t::Type=Any, args...)
4141
for i in eachindex(x)
4242
if isa(x[i], Exception)
43-
throw(x[i])
44-
elseif !isa(x[i], t) # typeof(x[i]) != t
45-
throw(TypeError(:RobustPmap, "checkexceptions for parameter $i", t, x[i]))
43+
@error("Execution failed for one of the runs (run #$(i)) with exception error $(typeof(x[i]))!")
44+
@error("Failing input parameter set: $(args[1][i])")
45+
throw(TypeError(:RobustPmap, t, x[i]))
46+
elseif !isa(x[i], t)
47+
@error("Execution failed for one of the runs (run #$(i))")
48+
@error("Failing input parameter set: $(args[1][i])")
49+
throw(TypeError(:RobustPmap, t, x[i]))
4650
end
4751
end
4852
return nothing
@@ -51,7 +55,7 @@ end
5155
"Robust pmap call"
5256
function rpmap(f::Function, args...; t::Type=Any)
5357
x = Distributed.pmap(f, args...; on_error=x->x)
54-
checkexceptions(x, t)
58+
checkexceptions(x, t, args...)
5559
return convert(Vector{t}, x)
5660
end
5761

0 commit comments

Comments
 (0)