-
Notifications
You must be signed in to change notification settings - Fork 35
Improve int indexing depwarn msg #694
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
Conversation
@davidanthoff @ckingdon95 should we leave the whole stacktrace, or nab just a part of it? If I take just the third line of the stack trace I think that will always be the line number of the expanded component, but that seems a little bit fragile. |
Codecov Report
@@ Coverage Diff @@
## master #694 +/- ##
==========================================
- Coverage 79.19% 79.16% -0.04%
==========================================
Files 39 39
Lines 2841 2851 +10
==========================================
+ Hits 2250 2257 +7
- Misses 591 594 +3
Continue to review full report at Codecov.
|
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.
@lrennels yeah I think if possible we could cut the first two or three lines
Although I think the whole component instance type might still get printed out on the "macro expansion" line. Have you tried it with the mimi-next branch of PAGE? does this make it any less long? |
actually maybe we can implement something even sneakier: if the error message is coming from inside of a run_timestep function (which 99% of these should be) then could your
followed by a line like:
So maybe we can drop any lines that start with "run_timestep" so that it would just return the previous line, the one that actually says the line number in the component code? |
@ckingdon95 yea that's exactly what I was thinking of doing, return the first line that starts with |
I think that makes sense to only return that line. But then if there aren't any lines that start with "macro expansion..." return the whole thing |
@ckingdon95 my testing showed some other cases here, maybe we can shorten the
|
@lrennels there are definitely tests in the test files where this arises outside of a "run_timestep" function, but I meant that in terms of actual users I think this warning will 99% be coming from "run_timestep" functions. |
src/core/time_arrays.jl
Outdated
s = string(s, line, "\n") | ||
line_string = string(line) | ||
if startswith(line_string, "run_timestep") # shorten the reporting on calls to run_timestep | ||
l = "run_timestep function call" |
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.
My preference would be to just return s
here. If it hits a "run_timestep" line, then the previous line would be the "macro expansion" line which has the actual component line number info of where the error is happening
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.
@ckingdon95 sounds good to me, done!
This PR addresses #690, and improves the error message for the deprecation warning associated with integer indexing. Since the Stacktrace will change in each call, the improvement for now prints out the
stacktrace()
stack frame line by line instead of as a text block, ie. the following.The component printout could still be quite long, however, but at least printed nicely.