11
11
from nbclient .exceptions import CellExecutionError
12
12
from nbclient import NotebookClient
13
13
14
- from traitlets import Unicode
14
+ from traitlets import Bool , Unicode
15
15
16
16
17
17
def strip_code_cell_warnings (cell ):
@@ -32,7 +32,7 @@ def strip_code_cell_warnings(cell):
32
32
class VoilaExecutor (NotebookClient ):
33
33
"""Execute, but respect the output widget behaviour"""
34
34
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 .' ,
36
36
config = True ,
37
37
help = (
38
38
'instruction given to user to debug cell errors'
@@ -47,6 +47,10 @@ class VoilaExecutor(NotebookClient):
47
47
)
48
48
)
49
49
50
+ show_tracebacks = Bool (False , config = True , help = (
51
+ 'Whether to send tracebacks to clients on exceptions.'
52
+ ))
53
+
50
54
def execute (self , nb , resources , km = None ):
51
55
try :
52
56
result = super (VoilaExecutor , self ).execute ()
@@ -77,7 +81,7 @@ async def execute_cell(self, cell, resources, cell_index, store_history=True):
77
81
78
82
def should_strip_error (self ):
79
83
"""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
81
85
82
86
def strip_notebook_errors (self , nb ):
83
87
"""Strip error messages and traceback from a Notebook."""
0 commit comments