1111from nbclient .exceptions import CellExecutionError
1212from nbclient import NotebookClient
1313
14- from traitlets import Unicode
14+ from traitlets import Bool , Unicode
1515
1616
1717def strip_code_cell_warnings (cell ):
@@ -32,7 +32,7 @@ def strip_code_cell_warnings(cell):
3232class VoilaExecutor (NotebookClient ):
3333 """Execute, but respect the output widget behaviour"""
3434 cell_error_instruction = Unicode (
35- 'Please run Voilà with --debug to see the error message.' ,
35+ 'Please run Voilà with --show_tracebacks=True or -- debug to see the error message, or configure VoilaConfigurion.show_tracebacks .' ,
3636 config = True ,
3737 help = (
3838 'instruction given to user to debug cell errors'
@@ -47,6 +47,10 @@ class VoilaExecutor(NotebookClient):
4747 )
4848 )
4949
50+ show_tracebacks = Bool (False , config = True , help = (
51+ 'Whether to send tracebacks to clients on exceptions.'
52+ ))
53+
5054 def execute (self , nb , resources , km = None ):
5155 try :
5256 result = super (VoilaExecutor , self ).execute ()
@@ -77,7 +81,7 @@ async def execute_cell(self, cell, resources, cell_index, store_history=True):
7781
7882 def should_strip_error (self ):
7983 """Return True if errors should be stripped from the Notebook, False otherwise, depending on the current config."""
80- return 'Voila' not in self .config or not self . config [ 'Voila' ]. get ( ' show_tracebacks' , False )
84+ return not self .show_tracebacks
8185
8286 def strip_notebook_errors (self , nb ):
8387 """Strip error messages and traceback from a Notebook."""
0 commit comments