diff options
| author | VG <vg@devys.org> | 2016-05-19 12:55:05 +0200 | 
|---|---|---|
| committer | VG <vg@devys.org> | 2016-05-19 12:55:05 +0200 | 
| commit | 473bcd0e3e7c545c36159356ceacb809836c963d (patch) | |
| tree | e54e0d286d98bd51aade7dcc0fdea2671c639133 | |
| parent | 4d2c093f4ba1d28ea0dc6a4429d6c5e6b98ba4a4 (diff) | |
| download | climl-473bcd0e3e7c545c36159356ceacb809836c963d.tar.gz climl-473bcd0e3e7c545c36159356ceacb809836c963d.tar.bz2 climl-473bcd0e3e7c545c36159356ceacb809836c963d.zip | |
Remove catchall rerun connect only if disconnected
Disconnections (socket/ssl errors) should be catched to retry connections.
Other exceptions should not be handled, instead hooks are encouraged to fix
their codes.
| -rw-r--r-- | climl/imap.py | 13 | 
1 files changed, 5 insertions, 8 deletions
| diff --git a/climl/imap.py b/climl/imap.py index 6bdcb04..0de15d8 100644 --- a/climl/imap.py +++ b/climl/imap.py @@ -3,7 +3,7 @@ import subprocess  import confparser  import imapclient  import contextlib -import backports.ssl +import backports.ssl as ssl  import socket  import time @@ -145,7 +145,10 @@ def main(callback=None):                      for oneid in idlist:                          print('calling callback...')                          callback('mail: ' + str(oneid)) -        except (socket.error, socket.timeout, backports.ssl.SSLError): +        except (socket.error, +                socket.timeout, +                ssl.SSLError, +                ssl.CertificateError):              print('socket/ssl error, retrying in 10s...')              try:                  time.sleep(10) # wait between retries @@ -153,10 +156,4 @@ def main(callback=None):                  break          except KeyboardInterrupt:              break -        except Exception as e: -            print('Unhandled exception during connection: ', e) -            try: -                time.sleep(10) # wait between retries -            except KeyboardInterrupt: -                break          print('end of connection') | 
