From ec7ae488bd9f904387e56007bd4bb1d69fe1b0e6 Mon Sep 17 00:00:00 2001 From: Jake <37048747+Jacob-Stevens-Haas@users.noreply.github.com> Date: Thu, 29 Feb 2024 15:38:54 +0000 Subject: [PATCH] feat: Allow exceptions in experiments to cause breakpoints in debug mode --- mitosis/__init__.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mitosis/__init__.py b/mitosis/__init__.py index c272006..f99290b 100644 --- a/mitosis/__init__.py +++ b/mitosis/__init__.py @@ -496,10 +496,14 @@ def _run_in_notebook( ep = ExecutePreprocessor(timeout=-1, kernel=kernel_name) exception = None metrics = None + if debug: + allowed = () + else: + allowed = (nbclient.exceptions.CellExecutionError,) try: ep.preprocess(nb, {"metadata": {"path": trials_folder}}) metrics = nb["cells"][-1]["outputs"][0]["text"][:-1] - except nbclient.exceptions.CellExecutionError as exc: + except allowed as exc: exception = exc return nb, metrics, exception