Skip to content

Commit 4d4f241

Browse files
authored
Merge pull request #78 from AnswerDotAI/fix/77-catch-error-before-exec
catch errors before exec
2 parents c503dcc + 7919972 commit 4d4f241

File tree

2 files changed

+194
-35
lines changed

2 files changed

+194
-35
lines changed

execnb/shell.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ def _run(self, raw_cell, store_history=False, silent=False, shell_futures=True,
7373
with capture_output(display=display, stdout=stdout and not verbose, stderr=stderr and not verbose) as c:
7474
result = super().run_cell(raw_cell, store_history, silent, shell_futures=shell_futures, cell_id=cell_id)
7575
return AttrDict(result=result, stdout='' if semic else c.stdout, stderr=c.stderr,
76-
display_objects=c.outputs, exception=result.error_in_exec, quiet=semic)
76+
display_objects=c.outputs,
77+
exception=result.error_in_exec or result.error_before_exec, quiet=semic)
7778

7879
def set_path(self, path):
7980
"Add `path` to python path, or `path.parent` if it's a file"

nbs/02_shell.ipynb

Lines changed: 192 additions & 34 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)