[PATCH 1/3] Catch correct type of exception

Sebastian Spaeth Sebastian at SSpaeth.de
Wed Aug 17 14:19:05 BST 2011


On Wed, 17 Aug 2011 10:11:04 +0200, Vladimir Marek <Vladimir.Marek at Oracle.COM> wrote:
> There is still something broken about catching exceptions. If the
> severity is > than FOLDER, but I haven't investigated why. If you throw
> OfflineImapError > FOLDER, it does not seem to be caught at all. It
> seems that this function should do it:

Yes, I can see that too. The problem is *again* threads. In
accounts.py:sync() we invoke new Thread() that runs syncfolder(). If an
Exception bubbles up to the beginning of syncfolder() (as any Exception
more severe than FOLDER will do), python will immediately abort, rather
than passing the Exception up to where the parent thread was invoked.

The weirdly undocumented ExitNotifyThread stuff in threadutil is already
providing some possibility to pass such an Exception up. (it catches it
etc). But, to be honest, I have never seriously looked into the system
as it seemed complex, undocumented, and somehow working. It seems it is
time to do so now...

I might have some ideas of how to improve this, but it will require some
investigation and thinking. If you are quicker than I am at coming up
with a clean solution, feel free to do so :)

Sebastian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://alioth-lists.debian.net/pipermail/offlineimap-project/attachments/20110817/ed6586c0/attachment-0001.sig>


More information about the OfflineIMAP-project mailing list