JuliaLang / IJulia.jl

Julia kernel for Jupyter
MIT License
2.78k stars 409 forks source link

IJulia kernel continues to execute subsequent cells after encountering a failed code cell #1069

Open bderrett opened 1 year ago

bderrett commented 1 year ago

When running a Jupyter notebook with a Julia kernel, I've noticed that the kernel continues to execute subsequent code cells even after encountering a failed code cell (i.e., a cell that throws an error). This behavior is different from what I experience when using a Python kernel in Jupyter, where the execution stops at the first failed code cell.

I'm not sure if this is a bug or an intended behavior, but I would like to have the option to stop execution at the first failed code cell, just like with a Python kernel.

Steps to reproduce:

  1. Create a new Jupyter notebook with a Julia kernel.
  2. Add three code cells with the following content:
    • First cell: x = 1
    • Second cell: y = x + "string" (This should throw an error)
    • Third cell: z = x + 1
  3. Run all cells in the notebook.
  4. Observe that the third cell is executed despite the error in the second cell.

Expected behavior:

The execution should stop at the second cell (the first failed code cell), and the third cell should not be executed.

Actual behavior:

The third cell is executed even though there's an error in the second cell.

Environment:

Please let me know if there's a way to change this behavior or if this is a bug. Thanks!