[PATCH 3/4] Re: Catch KeyboardInterrupts and raise them

Johannes Stezenbach js at sig21.net
Fri Dec 24 09:32:39 GMT 2010


On Thu, Dec 23, 2010 at 10:04:46PM +0100, Nicolas Sebrecht wrote:
> On Thu, Dec 23, 2010 at 08:43:08PM +0100, Johannes Stezenbach wrote:
> > On Wed, Dec 22, 2010 at 11:45:44PM +0100, Nicolas Sebrecht wrote:
> > > On Wed, Dec 22, 2010 at 03:27:19PM +0100, Sebastian Spaeth wrote:
> > > > 
> > > >                  except:
> > > > +                    #TODO, we should catch a specific Exception here, not ALL. But which?
> > > >                      pass
> > > 
> > > What do you have in mind? Why do we only catch one specific exception?
> > 
> > Instead of "catch all exceptions except KeyboardInterrupt",
> > how about "catch only EnvironmentError"?
> > http://docs.python.org/release/2.6.6/library/exceptions.html#exception-hierarchy
> > 
> > (Note that e.g. socket.error is a subclass of IOError).
> > 
> > Besides fixing the KeyboardInterrupt issue, it would also
> > give us back the tracebacks on unexpected errors.
> 
> But the IOError would be masked. I think we should have full tracebacks
> every where and only catch errors we are able to fix or workaround for
> sure.

Well, my understanding of EnvironmentError is that it exceptions
of that class (and subclasses) are usually not caused by errors in
the program, thus a traceback is usually not that interesting.
For example when I get a "connection failed" I need to check
my offlineimaprc and my network connection to the server and
not look at offlineimap sources...

Thanks,
Johannes




More information about the OfflineIMAP-project mailing list