-
Notifications
You must be signed in to change notification settings - Fork 22
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 #19
Conversation
Codecov Report
@@ Coverage Diff @@
## master #19 +/- ##
=====================================
Coverage 100% 100%
=====================================
Files 1 1
Lines 23 23
=====================================
Hits 23 23
Continue to review full report at Codecov.
|
Thanks for doing this! This is something I was meant to check this ever since I saw https://juliagpu.gitlab.io/CUDAnative.jl/man/hacking/#Generated-functions-1 (I don't know if it's an issue with CUDA yet, but why not make the body as pure as possible when we can.) |
An informative error message is great! Perhaps test the error message as well? |
@test_throws ArgumentError setproperties(o, (a=2, c=3.0)) | ||
@test_throws ArgumentError setproperties(o, a=2, c=3.0) | ||
res = @test_throws ArgumentError setproperties(o, (a=2, this_field_does_not_exist=3.0)) | ||
msg = sprint(showerror, res.value) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is accessing the error object like this is considered a public API?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I asked to make it so a while ago JuliaLang/julia#31854
Codecov ReportAll modified and coverable lines are covered by tests ✅
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## master #19 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 1 1
Lines 23 23
=========================================
Hits 23 23 ☔ View full report in Codecov by Sentry. |
Also the body of
@generated setproperties(...)
was impure as it was responsible for throwing the error. Not sure if this is a problem in practice, but it is forbidden in theory.