Skip to content

Commit cf47282

Browse files
author
Jack Dunham
committed
Remove try catch statement in RegionIterator construction for empty region_plan
Now just throws an `ArgumentError`
1 parent b9386f2 commit cf47282

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

src/iterators.jl

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,8 @@ mutable struct RegionIterator{Problem, RegionPlan} <: AbstractNetworkIterator
4747
which_region::Int
4848
const which_sweep::Int
4949
function RegionIterator(problem::P, region_plan::R, sweep::Int) where {P, R}
50-
try
51-
first(region_plan)
52-
catch e
53-
if e isa BoundsError
54-
throw(ArgumentError("Cannot construct a region iterator with 0 elements."))
55-
end
56-
rethrow()
50+
if isempty(region_plan)
51+
throw(ArgumentError("Cannot construct a region iterator with 0 elements."))
5752
end
5853
return new{P, R}(problem, region_plan, 1, sweep)
5954
end

0 commit comments

Comments
 (0)