Skip to content

Commit

Permalink
Show traceback before raising ExecutionError (#531)
Browse files Browse the repository at this point in the history
  • Loading branch information
paugier authored Aug 23, 2023
1 parent 3d6a5d1 commit aae27bb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions myst_nb/core/execute/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,12 @@ def start_client(self):
# handle success / failure cases
# TODO do in try/except to be careful (in case of database write errors?
if result.err is not None:
if self.nb_config.execution_raise_on_error:
raise ExecutionError(str(self.path)) from result.err
msg = f"Executing notebook failed: {result.err.__class__.__name__}"
if self.nb_config.execution_show_tb:
msg += f"\n{result.exc_string}"
self.logger.warning(msg, subtype="exec")
if self.nb_config.execution_raise_on_error:
raise ExecutionError(str(self.path)) from result.err
NbProjectRecord.set_traceback(stage_record.uri, result.exc_string, cache.db)
else:
self.logger.info(f"Executed notebook in {result.time:.2f} seconds")
Expand Down

0 comments on commit aae27bb

Please sign in to comment.