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

improve setproperties() error message #93

Merged
merged 2 commits into from
Aug 21, 2024
Merged

improve setproperties() error message #93

merged 2 commits into from
Aug 21, 2024

Conversation

aplavin
Copy link
Member

@aplavin aplavin commented Aug 21, 2024

Currently, it can be both too long and unclear for novices (I saw some confusion), eg:

ERROR: The function Base.propertynames was overloaded for type Mesh{3, Float32, GeometryBasics.Ngon{3, Float32, 3, Point{3, Float32}}, SimpleFaceView{3, Float32, 3, OffsetInteger{-1, UInt32}, Point{3, Float32}, NgonFace{3, OffsetInteger{-1, UInt32}}}}.
Please make sure ConstructionBase.setproperties is also overloaded for this type.

This PR changes it to:

The Mesh type defines custom properties: it has propertynames overloaded.
Please define ConstructionBase.setproperties(::Mesh, ::NamedTuple) to set its properties.

Happy to rephrase if you have other suggestions!

Copy link
Member

@jw3126 jw3126 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have a test that triggers this error? E.g. undefined variable sneaks in easily into error messages with string interpolation, so worth a test if we don't have already.

@aplavin
Copy link
Member Author

aplavin commented Aug 21, 2024

I think so, around here:

res = @test_throws ErrorException setproperties(x, c=0)
msg = sprint(showerror, res.value)
@test occursin("overload", msg)
@test occursin("setproperties", msg)
@test occursin("FieldProps", msg)

@aplavin aplavin merged commit 1dbfa1a into master Aug 21, 2024
64 of 72 checks passed
@aplavin aplavin deleted the error branch August 21, 2024 22:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants