Skip to content

Commit 33cd1d4

Browse files
committed
Add show_tracebacks trait
1 parent 50752bb commit 33cd1d4

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

voila/app.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,10 @@ class Voila(Application):
7676
examples = 'voila example.ipynb --port 8888'
7777

7878
flags = {
79-
'debug': ({'Voila': {'log_level': logging.DEBUG}}, _("Set the log level to logging.DEBUG")),
79+
'debug': (
80+
{'Voila': {'log_level': logging.DEBUG, 'show_tracebacks': True}},
81+
_("Set the log level to logging.DEBUG, and show exception tracebacks in output.")
82+
),
8083
'no-browser': ({'Voila': {'open_browser': False}}, _('Don\'t open the notebook in a browser after startup.'))
8184
}
8285

@@ -186,6 +189,10 @@ class Voila(Application):
186189
)
187190
)
188191

192+
show_tracebacks = Bool(False, config=True, help=_(
193+
'Whether to send tracebacks to clients on exceptions.'
194+
))
195+
189196
port_retries = Integer(50, config=True,
190197
help=_("The number of additional ports to try if the specified port is not available.")
191198
)

voila/execute.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ async def execute_cell(self, cell, resources, cell_index, store_history=True):
7979

8080
def should_strip_error(self):
8181
"""Return True if errors should be stripped from the Notebook, False otherwise, depending on the current config."""
82-
return 'Voila' not in self.config or 'log_level' not in self.config['Voila'] or self.config['Voila']['log_level'] != logging.DEBUG
82+
return 'Voila' not in self.config or not self.config['Voila'].get('show_tracebacks', False)
8383

8484
def strip_notebook_errors(self, nb):
8585
"""Strip error messages and traceback from a Notebook."""

0 commit comments

Comments
 (0)