mirror of
https://github.com/facebook/sapling.git
synced 2025-01-01 09:37:56 +03:00
dispatch: enter ipdb for "NameError 'ipdb' is not defined"
Summary: This allows entering ipdb for code like: `ipdb` or `ipdb()`. It can be handy to debug something. Reviewed By: DurhamG Differential Revision: D23278599 fbshipit-source-id: 4355dd1944617aeb795450935789f01f66f094eb
This commit is contained in:
parent
28fa0e1cfe
commit
d92c80ebcc
@ -725,18 +725,23 @@ def _callcatch(ui, func):
|
||||
raise
|
||||
except: # probably re-raises
|
||||
# Potentially enter ipdb debugger when we hit an uncaught exception
|
||||
ex = sys.exc_info()[1]
|
||||
isipdb = isinstance(ex, NameError) and "'ipdb'" in str(ex)
|
||||
if (
|
||||
ui.configbool("devel", "debugger")
|
||||
(ui.configbool("devel", "debugger") or isipdb)
|
||||
and ui.interactive()
|
||||
and not ui.pageractive
|
||||
and not ui.plain()
|
||||
and ui.formatted
|
||||
):
|
||||
ui.write_err(
|
||||
_(
|
||||
"Starting ipdb for this exception\nIf you don't want the behavior, set devel.debugger to False\n"
|
||||
if isipdb:
|
||||
ui.write_err(_("Starting ipdb for 'ipdb'\n"))
|
||||
else:
|
||||
ui.write_err(
|
||||
_(
|
||||
"Starting ipdb for this exception\nIf you don't want the behavior, set devel.debugger to False\n"
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
with demandimport.deactivated():
|
||||
import ipdb
|
||||
|
Loading…
Reference in New Issue
Block a user