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

summary: another band-aid for missing stacktrace #17

Merged
merged 2 commits into from
Dec 30, 2023
Merged

Conversation

msagarpatel
Copy link
Collaborator

The following error was reported:

UndefVarError: `bt` not defined

Previously, a different error was reported where bt was a 0-length vector. Why the stacktrace is missing is not known in either case.

@msagarpatel msagarpatel requested a review from NHDaly December 28, 2023 14:48
Copy link

codecov bot commented Dec 28, 2023

Welcome to Codecov 🎉

Once merged to your default branch, Codecov will compare your coverage reports and display the results in this comment.

Thanks for integrating Codecov - We've got you covered ☂️

@@ -143,9 +143,10 @@ function _summarize_exception(io::IO, exc, stack; prefix = nothing)
end
end
# Now print just the very first frame we've collected:
if isempty(bt)
if ! @isdefined :bt || isempty(bt)
Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps we should define it as empty vector instead of local bt, in case it doesn't enter the loop.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

👍 done in bd720cf.

Copy link
Member

Choose a reason for hiding this comment

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

nice suggestion! FWIW Sagar, the previous code had a small typo in it. You want either of these two options: @isdefined(bt) or isdefined(@__MODULE__, :bt). What you have is checking if the symbol exists and that will be a type error:

julia> @isdefined(:hi)
ERROR: LoadError: MethodError: no method matching var"@isdefined"(::LineNumberNode, ::Module, ::QuoteNode)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

😮 Thanks for pointing that out, @NHDaly! I see how this happened. Initially (before I filed this PR) I had written:

if !isdefined(Base, :bt) || isempty(bt)

which was correct (I think), but I didn't like it stylistically, so I pattern-matched changed it to:

if ! @isdefined :bt || isempty(bt)

which was definitely incorrect!

The following error was reported:

	UndefVarError: `bt` not defined

Previously, a different error was reported where bt was a 0-length
vector. Why the stacktrace is missing is not known in either case.
src/exception_summary.jl Outdated Show resolved Hide resolved
Copy link
Member

@NHDaly NHDaly left a comment

Choose a reason for hiding this comment

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

LGTM thanks. strange though, yeah..

@NHDaly NHDaly merged commit ff68124 into master Dec 30, 2023
8 checks passed
@NHDaly NHDaly deleted the sp-bt-undefined branch December 30, 2023 21:37
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.

3 participants