If you do something like:
include("file_with_missing_dependency.jl")
you get a warning like:
ERROR: LoadError: LoadError: UndefVarError: SomeUnloadedVar not defined
Stacktrace:
[1] include_from_node1(::String) at ./loading.jl:569
[2] include(::String) at ./sysimg.jl:14
... // wherever you called include from
If you wrap the include()
in a try-catch
, you get some more information, namely:
cur_error = {
"file" => "/Users/.../file_with_missing_dependency.jl",
"line" => 42, # whatever line has "SomeUnloadedVar"
"error" => {
"var" => :SomeUnloadedVar
}
}
Is there a way to get the stacktrace inside the file being loaded?
Like exactly how nested is that 42
.
Is it relatively decoupled like this:
41
42 dummy_var = SomeUnloadedVar.rand()
43
or the much more tangled scenario:
30 for i in 1:10
... dummy_var = ( 1 +
41 SomeUnloadedVar.rand()
42 )
43 ...
summarizing. would it be possible to find the line value of 30
in the above code block?
// using existing debugging tools