Skip to content

Commit

Permalink
fix error catching
Browse files Browse the repository at this point in the history
  • Loading branch information
gaubert committed Mar 26, 2012
1 parent 39499e7 commit e3d96f3
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/gmv/imap_utils.py
Expand Up @@ -102,22 +102,29 @@ def wrapper(*args, **kwargs): #pylint:disable-msg=C0111
LOG.critical("Cannot reach the gmail server (see logs). Wait %s seconds and retrying." % (m_sleep_time[0]))

reconnect(args[0], nb_tries, p_err, m_sleep_time)
except imaplib.IMAP4.error, err:

except imaplib.IMAP4.abort, err: #abort is recoverable and error is not

LOG.debug("error message = %s. traceback:%s" % (err, gmvault_utils.get_exception_traceback()))

LOG.critical("Cannot reach the gmail server (see logs). Wait 1 seconds and retrying")

# problem with this email, put it in quarantine
reconnect(args[0], nb_tries, err, m_sleep_time)

reconnect(args[0], nb_tries, err, m_sleep_time)
except socket.error, sock_err:
LOG.debug("error message = %s. traceback:%s" % (sock_err, gmvault_utils.get_exception_traceback()))

LOG.critical("Cannot reach the gmail server (see logs). Wait 1 seconds and retrying")

reconnect(args[0], nb_tries, sock_err, m_sleep_time)

except imaplib.IMAP4.error, err:

#just trace it back for the moment
LOG.debug("IMAP (normal) error message = %s. traceback:%s" % (err, gmvault_utils.get_exception_traceback()))

raise err

return functools.wraps(the_func)(wrapper)
#return wrapper
Expand Down

0 comments on commit e3d96f3

Please sign in to comment.