[wingide-users] Selective exception handling

Wingware Support support at wingware.com
Tue Oct 24 10:40:40 MDT 2006


On Tue, 24 Oct 2006, Toni Ruža wrote:
> On 10/24/06, Tony Cappellini <cappy2112 at gmail.com> wrote:
> > 
> > Would it be possible to modify Wing (without hurting performance) so that
> > the "Always Report if unhandled" option could be qualified by the exception
> > type?
> > 
> > For example, If an app is throwing exceptions A,B,C,G,X,Y , but I'm only
> > interested in debugging exceptions A,D,G
> 
> a simple trick would be to ignore exception reports completely and put
> breakpoints in the exception blocks you wish to debug.
> 
> if you don't have the exception blocks (ie. you don't handle them),
> wrap your entire app in a temporary try except except ...

Good point.  You can also make the outer try/exception 
conditional on whether running in Wing's debugger like so:

def x():
  # your main code here

import os
if os.environ.has_key('WINGDB_ACTIVE'):
  try:
    x()
  except:
    print "exception" # Put breakpoints or logging here
else:
  x()

Hope that helps.

- Stephan


More information about the wingide-users mailing list