# How to debug exception triggered by unit test in VSCode

**URL:** https://discourse.julialang.org/t/how-to-debug-exception-triggered-by-unit-test-in-vscode/90438
**Category:** VS Code
**Tags:** debugger
**Created:** [November 18, 2022, 11:39am UTC](https://discourse.julialang.org/t/how-to-debug-exception-triggered-by-unit-test-in-vscode/90438 "2022-11-18T11:39:03Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![nrontsis](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nrontsis/32/38535_2.png) [@nrontsis](https://discourse.julialang.org/u/nrontsis)
#### Post date: [November 18, 2022, 11:39am UTC](https://discourse.julialang.org/t/how-to-debug-exception-triggered-by-unit-test-in-vscode/90438/1 "2022-11-18T11:39:03Z")

</div>

Suppose the following minimal example, that triggers an exception in its execution, due to the `return x + 1` line:

```julia
using Test

function f(x)
    return x + 1
end

@test f([0]) == [1]

```

I want to launch a debugging session on this via VSCode.

However, if I try to launch one with VSCode’s `@run` I get the following unhelpful call stack:

 ![output](https://global.discourse-cdn.com/julialang/original/3X/d/a/da4648dd73f10243fe7a90f7baa7d5b697042ebf.png)

Instead I want to get the full call stack, including inside the call to `f`.

---

<div class="post-metadata">

### Author: ![nrontsis](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nrontsis/32/38535_2.png) [@nrontsis](https://discourse.julialang.org/u/nrontsis)
#### Post date: [November 20, 2022, 6:12pm UTC](https://discourse.julialang.org/t/how-to-debug-exception-triggered-by-unit-test-in-vscode/90438/2 "2022-11-20T18:12:26Z")

</div>

It appears that pressing `Step-Into (F11)` and then `Continue (F5)` when at the original call stack of the above screenshot brings us to the line of `f` that originally creates the exception.

For this to work “BREAKPOINTS → All Exceptions” has to be enabled.

Is this expected behaviour?
