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

Better child error when creating geom from array #154

Merged
merged 1 commit into from
Sep 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/wrappers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -186,10 +186,10 @@ for (geomtype, trait, childtype, child_trait, length_check, nesting) in (
# Otherwise wrap an array of child geometries
elseif geom isa AbstractArray
child = first(geom)
chilren_match = all(child -> geomtrait(child) isa $child_trait, geom)
children_match = findfirst(child -> !(geomtrait(child) isa $child_trait), geom)

# Where the next level down is the child geometry
if chilren_match
if isnothing(children_match)
if $(!isnothing(length_check))
$length_check(Base.length(geom)) || _length_error($geomtype, $length_check, geom)
end
Expand Down Expand Up @@ -219,7 +219,7 @@ for (geomtype, trait, childtype, child_trait, length_check, nesting) in (
end
end
# Otherwise compain the nested child type is wrong
_wrong_child_error($trait, $child_trait, child)
_wrong_child_error($trait, $child_trait, geom[children_match])
end
else
# Or complain the parent type is wrong
Expand Down
Loading