# Error locations for longer IJulia Cells

**URL:** https://discourse.julialang.org/t/error-locations-for-longer-ijulia-cells/10688
**Category:** General Usage
**Created:** [May 3, 2018, 3:06pm UTC](https://discourse.julialang.org/t/error-locations-for-longer-ijulia-cells/10688 "2018-05-03T15:06:09Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![habemus-papadum](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/habemus-papadum/32/4086_2.png) [@habemus-papadum](https://discourse.julialang.org/u/habemus-papadum)
#### Post date: [May 3, 2018, 3:06pm UTC](https://discourse.julialang.org/t/error-locations-for-longer-ijulia-cells/10688/1 "2018-05-03T15:06:09Z")

</div>

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

```julia
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:

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

```

Output:

```julia
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?

---

<div class="post-metadata">

### Author: ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)
#### Post date: [May 4, 2018, 2:36am UTC](https://discourse.julialang.org/t/error-locations-for-longer-ijulia-cells/10688/2 "2018-05-04T02:36:53Z")

</div>

The IJulia [`error_content` function](https://github.com/JuliaLang/IJulia.jl/blob/e11ae261fee943eec665e90203cdab7dc4f0ee66/src/execute_request.jl#L76-L95) should be updated to output `e.file` and `e.line` from the `LoadError` from `include_string`. A PR would be welcome.

---

<div class="post-metadata">

### Author: ![habemus-papadum](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/habemus-papadum/32/4086_2.png) [@habemus-papadum](https://discourse.julialang.org/u/habemus-papadum)
#### Post date: [May 4, 2018, 11:34am UTC](https://discourse.julialang.org/t/error-locations-for-longer-ijulia-cells/10688/3 "2018-05-04T11:34:23Z")

</div>

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
