Skip to content

Commit

Permalink
Add show_tracebacks trait
Browse files Browse the repository at this point in the history
  • Loading branch information
vidartf committed Sep 14, 2020
1 parent 50752bb commit 97c1829
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion voila/app.py
Expand Up @@ -76,7 +76,10 @@ class Voila(Application):
examples = 'voila example.ipynb --port 8888'

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

Expand Down Expand Up @@ -186,6 +189,10 @@ class Voila(Application):
)
)

show_tracebacks = Bool(False, config=True, help=_(
'Whether to send tracebacks to clients on exceptions.'
))

port_retries = Integer(50, config=True,
help=_("The number of additional ports to try if the specified port is not available.")
)
Expand Down
2 changes: 1 addition & 1 deletion voila/execute.py
Expand Up @@ -79,7 +79,7 @@ async def execute_cell(self, cell, resources, cell_index, store_history=True):

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

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

0 comments on commit 97c1829

Please sign in to comment.