[IPython-dev] [Ipython-svndiff] 2717 - improve callable alias inspection

Gael Varoquaux gael.varoquaux@normalesup....
Thu Sep 6 01:45:44 CDT 2007


On Thu, Sep 06, 2007 at 12:32:26AM -0600, Fernando Perez wrote:
> Here's an idea that might help with this.  We could define a special
> DebugException as follows:

> if debug_flag_given:
>   class CatchAllException(Exception): pass
> else:
>   # normal mode
>   CatchAllException = Exception

> Then, all code that needs to have very wide-ranging excepts can be
> written as:

> try:
>   whatever...
> except (E1,E2,E3):
>   handle what you know what to do with...
> except CatchAllException:
>   # in normal mode
>   pass
> except:
>   print 'Normally suppressed traceback shown:'
>   self.showtraceback()

You might want to look at the way traits and envisage do it. You can look
at the code around

enthought.traits.api.push_exception_handler

They have a elaborate exception handling framework that answers this kind
of problems.

Gaël



More information about the IPython-dev mailing list