I’m exploring Infiltrator.jl and I am not clear on the use case or purpose of @infiltry. I thought that it would help me debug by catching the state of the code when the exception occurred, but this does not seem to be the case. I thought in this example x would be one of the locals available in the infil> prompt.
julia> using Infiltrator
julia> function foo()
x = -1
sqrt(x)
end
foo (generic function with 1 method)
julia> Main.@infiltry foo()
[ Warning: @infiltry is defined in Infiltrator and is not public in Main
EXCEPTION while infiltrating (on thread 1) top-level frame
infil> @locals
No local variables in this scope.
infil> @exception
ERROR: DomainError with -1.0:
sqrt was called with a negative real argument but will only return a complex result if called with a complex argument. Try sqrt(Complex(x)).
Stacktrace:
[1] throw_complex_domainerror(f::Symbol, x::Float64)
@ Base.Math ./math.jl:33
[2] sqrt
@ ./math.jl:627 [inlined]
[3] sqrt(x::Int64)
@ Base.Math ./math.jl:1546
[4] foo()
@ Main ./REPL[7]:4
[5] top-level scope
@ REPL[8]:186
[6] macro expansion
@ ~/.julia/packages/Infiltrator/W339g/src/Infiltrator.jl:187 [inlined]
What situations is @infiltry useful?