Properly re-raise exception to save original tracebacks
We usually mutate some exceptions to OfflineImapError() and it is a whole lot better if such exception will show up with the original traceback, so all valid occurrences of such mutations were transformed to the 3-tuple form of "raise". Had also added coding guidelines document where this re-raise strategy is documented. Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
This commit is contained in:
@ -18,6 +18,7 @@ import os
|
||||
import fcntl
|
||||
import time
|
||||
import subprocess
|
||||
from sys import exc_info
|
||||
import threading
|
||||
from hashlib import sha1
|
||||
|
||||
@ -54,7 +55,7 @@ class UsefulIMAPMixIn(object):
|
||||
errstr = "Server '%s' closed connection, error on SELECT '%s'. Ser"\
|
||||
"ver said: %s" % (self.host, mailbox, e.args[0])
|
||||
severity = OfflineImapError.ERROR.FOLDER_RETRY
|
||||
raise OfflineImapError(errstr, severity)
|
||||
raise OfflineImapError(errstr, severity), None, exc_info()[2]
|
||||
if result[0] != 'OK':
|
||||
#in case of error, bail out with OfflineImapError
|
||||
errstr = "Error SELECTing mailbox '%s', server reply:\n%s" %\
|
||||
|
Reference in New Issue
Block a user