Patchwork [3,of,3,STABLE,V2] dispatch: include chained exceptions in printed tracebacks when using --debugger

login
register
mail settings
Submitter Matt Harbison
Date Feb. 9, 2013, 6:06 a.m.
Message ID <1d5e86b74e77d9b26e90.1360390005@Envy>
Download mbox | patch
Permalink /patch/852/
State Superseded, archived
Headers show

Comments

Matt Harbison - Feb. 9, 2013, 6:06 a.m.
# HG changeset patch
# User Matt Harbison <matt_harbison@yahoo.com>
# Date 1360388823 18000
# Branch stable
# Node ID 1d5e86b74e77d9b26e90159d42bd68822866c748
# Parent  1744b3545df41d6202a0f0857a17d1053ad44b71
dispatch: include chained exceptions in printed tracebacks when using --debugger
Mads Kiilerich - Feb. 9, 2013, 10:09 a.m.
On 02/09/2013 07:06 AM, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison <matt_harbison@yahoo.com>
> # Date 1360388823 18000
> # Branch stable
> # Node ID 1d5e86b74e77d9b26e90159d42bd68822866c748
> # Parent  1744b3545df41d6202a0f0857a17d1053ad44b71
> dispatch: include chained exceptions in printed tracebacks when using --debugger

That seems to be more of a side effect of switching to use 
ui.traceback() for all printing of tracebacks ... which seems like a 
good idea.

> diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
> --- a/mercurial/dispatch.py
> +++ b/mercurial/dispatch.py
> @@ -91,7 +91,8 @@
>           except: # re-raises
>               # enter the debugger when we hit an exception
>               if '--debugger' in req.args:
> -                traceback.print_exc()

It seems like this removes the last use of the traceback module from 
dispatch, so the import should go too.

> +                ui.tracebackflag=True
> +                ui.traceback()

Setting tracebackflag in our 'global variable namespace' (aka ui) is not 
so pretty. I think I have a slight preference for adding an optional 
'force' or 'always' flag to ui.traceback.


>                   pdb.post_mortem(sys.exc_info()[2])
>               ui.traceback()
>               raise

/Mads

Patch

diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
--- a/mercurial/dispatch.py
+++ b/mercurial/dispatch.py
@@ -91,7 +91,8 @@ 
         except: # re-raises
             # enter the debugger when we hit an exception
             if '--debugger' in req.args:
-                traceback.print_exc()
+                ui.tracebackflag=True
+                ui.traceback()
                 pdb.post_mortem(sys.exc_info()[2])
             ui.traceback()
             raise