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 #19

Merged
merged 3 commits into from
Oct 3, 2019
Merged

Improve setproperties error message #19

merged 3 commits into from
Oct 3, 2019

Conversation

jw3126
Copy link
Member

@jw3126 jw3126 commented Oct 2, 2019

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.

@codecov-io
Copy link

codecov-io commented Oct 2, 2019

Codecov Report

Merging #19 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master    #19   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files           1      1           
  Lines          23     23           
=====================================
  Hits           23     23
Impacted Files Coverage Δ
src/ConstructionBase.jl 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9eb7316...9515d4a. Read the comment docs.

@tkf
Copy link
Member

tkf commented Oct 2, 2019

Also the body of @generated setproperties(...) was impure as it was responsible for throwing the error.

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.)

@tkf
Copy link
Member

tkf commented Oct 2, 2019

An informative error message is great! Perhaps test the error message as well? ArgumentError could be thrown by something else. But essentially LGTM.

@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)
Copy link
Member Author

@jw3126 jw3126 Oct 3, 2019

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?

Copy link
Member

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

@jw3126 jw3126 merged commit 23937e9 into master Oct 3, 2019
@codecov-commenter
Copy link

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (9eb7316) to head (9515d4a).
Report is 171 commits behind head on master.

❗ 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.
📢 Have feedback on the report? Share it here.

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.

4 participants