Skip to content

Commit ac97e0c

Browse files
committed
remove redundant assert + error on max_dist<0 in segmentize
1 parent cfeaf67 commit ac97e0c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/transformations/segmentize.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,14 +178,15 @@ segmentize(method::Manifold, geom, max_distance::Real; threaded = False()) = seg
178178

179179
# generic implementation
180180
function segmentize(method::Manifold, geom; max_distance, threaded::Union{Bool, BoolsAsTypes} = False())
181-
@assert max_distance > 0 "`max_distance` should be positive and nonzero! Found $(method.max_distance)."
181+
if max_distance > 0
182+
throw(ArgumentError("`max_distance` should be positive and nonzero! Found $(method.max_distance)."))
183+
end
182184
_segmentize_function(geom) = _segmentize(method, geom, GI.trait(geom); max_distance)
183185
return apply(_segmentize_function, TraitTarget(GI.LinearRingTrait(), GI.LineStringTrait()), geom; threaded)
184186
end
185187

186188
function segmentize(method::SegmentizeMethod, geom; threaded::Union{Bool, BoolsAsTypes} = False())
187189
@warn "`segmentize(method::$(typeof(method)), geom) is deprecated; use `segmentize($(method isa LinearSegments ? "Planar()" : "Geodesic()"), geom; max_distance, threaded) instead!" maxlog=3
188-
@assert method.max_distance > 0 "`max_distance` should be positive and nonzero! Found $(method.max_distance)."
189190
new_method = method isa LinearSegments ? Planar() : Geodesic()
190191
segmentize(new_method, geom; max_distance = method.max_distance, threaded)
191192
end

0 commit comments

Comments
 (0)