How to find the error line using try/catch statements?

You want rethrow

julia> function foo()
           throw(error("hello"))
       end;

julia> try
           foo()
       catch e
           println("foo threw an error")
           rethrow(e)
       end
foo threw an error
ERROR: hello
Stacktrace:
 [1] error(s::String)
   @ Base .\error.jl:33
 [2] foo()
   @ Main .\REPL[33]:2
 [3] top-level scope
   @ REPL[34]:2
6 Likes