Error locations for longer IJulia Cells


#1

Hi – If I have an error in a relatively long IJulia cell, IJulia correctly describes the error, but does not specify the location:

In[1]:
x = 2
y = 3
z = not_defined
a = 4
b = 5

output:
UndefVarError: not_defined not defined

For a long cell, this makes it difficult to find the location of the error.
If I had wrapped the statements in a function:

In[1]:
function wrap() 
x = 2
y = 3
z = not_defined
a = 4
b = 5
end
wrap()

Output:

UndefVarError: not_defined not defined

Stacktrace:
 [1] wrap() at ./In[41]:4

then the error message provides a helpful location, but since I’m developing interactively, I want to easily modify the global scope.

Is there a way to work around this issue?


#2

The IJulia error_content function should be updated to output e.file and e.line from the LoadError from include_string. A PR would be welcome.


#3

Thanks for the pointer! quick question regarding a fix/PR: looking through the code you referenced, the backtrace formatting logic seems subtle – in your opinion, what is the likelihood that a fix involves making a few small changes that won’t lead to subtle (or not so subtle) regressions elsewhere? – I’m happy to have a go regardless, but I’m unclear whether I should meditate and create some sort of plan of attack in advance of any hacking, or should I “just do it, cause it’s not that hard” Cheers