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:
@ -16,6 +16,7 @@
|
||||
|
||||
import os
|
||||
import re
|
||||
from sys import exc_info
|
||||
|
||||
try:
|
||||
from ConfigParser import SafeConfigParser, Error
|
||||
@ -75,7 +76,7 @@ class CustomConfigParser(SafeConfigParser):
|
||||
return re.split(separator_re, val)
|
||||
except re.error as e:
|
||||
raise Error("Bad split regexp '%s': %s" % \
|
||||
(separator_re, e))
|
||||
(separator_re, e)), None, exc_info()[2]
|
||||
|
||||
def getdefaultlist(self, section, option, default, separator_re):
|
||||
"""Same as getlist, but returns the value of `default`
|
||||
|
Reference in New Issue
Block a user