Get location and variable name from UndefVarError

Hi All,

How can I get an undefined variable name and its location?
For example, in the code below

x = a +1

The output is:

UndefVarError: `a` not defined

Stacktrace:
 [1] top-level scope
   @ In[1]:1

How do I get out (from “Stacktrace”) the variable name and its location (row,column)? What I would need is a tupel object (“a”,1,5)

Thank you in advance

For the variable name and line:

function foo()
    x = a + 1
end

global err;

s = try
        foo()
    catch err
        stacktrace(catch_backtrace())
    end

st = first(s);
(err.var, st.line)

I’m not sure how to get the column.

How about column number?