You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# this function will be called on exceptions in any celldefwhen_exception(shell, etype, evalue, tb, tb_offset=None):
# still show the error within the notebook, don't just swallow itshell.showtraceback((etype, evalue, tb), tb_offset=tb_offset)
err_msg=f'Unexpected exception occured: {repr(evalue)}'logger.error(err_msg)
print('do your stuff here ...')
# this registers a custom exception handler for the whole current notebookfromIPythonimportget_ipythonget_ipython().set_custom_exc((Exception,), when_exception)