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

Extra frames in nested exception when error includeing #27

Closed
BioTurboNick opened this issue May 11, 2021 · 4 comments
Closed

Extra frames in nested exception when error includeing #27

BioTurboNick opened this issue May 11, 2021 · 4 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@BioTurboNick
Copy link
Owner

BioTurboNick commented May 11, 2021

Consider trimming top-level frames when an error is encountered when using a package.

To reproduce, just add an undefined variable name inside a module then trigger precompilation via using.

[ Info: Precompiling BioFetch [f8217676-c24a-4825-a874-ba6ce2a4fe08]
ERROR: LoadError: UndefVarError: Format not defined
Stacktrace:
 [1] top-level scope
   @ ~/.julia/dev/BioFetch/src/BioFetch.jl:72
 [2] include
   @ ./Base.jl:389 [inlined]
 [3] include_package_for_output(pkg::Base.PkgId, input::String, depot_path::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_deps::Vector{Pair{Base.PkgId, UInt64}}, source::Nothing)
   @ Base ./loading.jl:1219
 [4] top-level scope
   @ none:1
 [5] eval
   @ ./boot.jl:369 [inlined]
 [6] eval(x::Expr)
   @ Base.MainInclude ./client.jl:456
 [7] top-level scope
   @ none:1
in expression starting at /home/nicho/.julia/dev/BioFetch/src/BioFetch.jl:1
ERROR: Failed to precompile BioFetch [f8217676-c24a-4825-a874-ba6ce2a4fe08] to /home/nicho/.julia/compiled/v1.7/BioFetch/jl_kjdfEq.
@BioTurboNick
Copy link
Owner Author

It isn't possible through the normal route. That first stacktrace is emitted outside the REPL, so it doesn't flow through my code. It doesn't use the show_backtrace path at all.

Ideally, frames 2-7 would be stripped I think, but only when called via the REPL?

@BioTurboNick
Copy link
Owner Author

It presumably goes through showerror(io::IO, ex::LoadError, bt; backtrace=true) and then from there to show_backtrace, but doesn't seem like I can overwrite it via a package. May be stuck using earlier versions of the functions?

Perhaps this can't be considered until being put into Base?

@BioTurboNick BioTurboNick added enhancement New feature or request help wanted Extra attention is needed labels May 18, 2021
@BioTurboNick
Copy link
Owner Author

BioTurboNick commented Oct 11, 2022

A note: You don't need any of it because the information is provided in the in expression starting section now. Except apparently sometimes it is not? Hmm.

@BioTurboNick
Copy link
Owner Author

Current Julia trims include-related frames on its own.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant