correctly reraise errors with six
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:
@ -110,8 +110,12 @@ class IMAPRepository(BaseRepository):
|
||||
try:
|
||||
host = self.localeval.eval(host)
|
||||
except Exception as e:
|
||||
six.reraise(OfflineImapError("remotehosteval option for repository "
|
||||
"'%s' failed:\n%s"% (self, e), OfflineImapError.ERROR.REPO), None, exc_info()[2])
|
||||
six.reraise(OfflineImapError,
|
||||
OfflineImapError(
|
||||
"remotehosteval option for repository "
|
||||
"'%s' failed:\n%s"% (self, e),
|
||||
OfflineImapError.ERROR.REPO),
|
||||
exc_info()[2])
|
||||
if host:
|
||||
self._host = host
|
||||
return self._host
|
||||
|
@ -1,5 +1,4 @@
|
||||
# Copyright (C) 2002-2007 John Goerzen <jgoerzen@complete.org>
|
||||
# 2010 Sebastian Spaeth <Sebastian@SSpaeth.de> and contributors
|
||||
# Copyright (C) 2002-2016 John Goerzen & contributors.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@ -15,9 +14,8 @@
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
from sys import exc_info
|
||||
|
||||
import six
|
||||
from sys import exc_info
|
||||
|
||||
try:
|
||||
from configparser import NoSectionError
|
||||
@ -70,14 +68,18 @@ class Repository(object):
|
||||
except NoSectionError as e:
|
||||
errstr = ("Could not find section '%s' in configuration. Required "
|
||||
"for account '%s'." % ('Repository %s' % name, account))
|
||||
six.reraise(OfflineImapError(errstr, OfflineImapError.ERROR.REPO), None, exc_info()[2])
|
||||
six.reraise(OfflineImapError,
|
||||
OfflineImapError(errstr, OfflineImapError.ERROR.REPO),
|
||||
exc_info()[2])
|
||||
|
||||
try:
|
||||
repo = typemap[repostype]
|
||||
except KeyError:
|
||||
errstr = "'%s' repository not supported for '%s' repositories."% \
|
||||
(repostype, reqtype)
|
||||
six.reraise(OfflineImapError(errstr, OfflineImapError.ERROR.REPO), None, exc_info()[2])
|
||||
six.reraise(OfflineImapError,
|
||||
OfflineImapError(errstr, OfflineImapError.ERROR.REPO),
|
||||
exc_info()[2])
|
||||
|
||||
return repo(name, account)
|
||||
|
||||
|
Reference in New Issue
Block a user