mirror of
https://github.com/powerline/powerline.git
synced 2025-07-23 13:55:45 +02:00
Handle socket errors in IMAP mail segment
This commit is contained in:
parent
cb87cfbe0f
commit
be62815c0b
@ -478,6 +478,8 @@ def email_imap_alert(username, password, server='imap.gmail.com', port=993, fold
|
|||||||
rc, message = mail.status(folder, '(UNSEEN)')
|
rc, message = mail.status(folder, '(UNSEEN)')
|
||||||
unread_str = message[0].decode('utf-8')
|
unread_str = message[0].decode('utf-8')
|
||||||
unread_count = int(re.search('UNSEEN (\d+)', unread_str).group(1))
|
unread_count = int(re.search('UNSEEN (\d+)', unread_str).group(1))
|
||||||
|
except socket.gaierror:
|
||||||
|
return None
|
||||||
except imaplib.IMAP4.error as e:
|
except imaplib.IMAP4.error as e:
|
||||||
unread_count = str(e)
|
unread_count = str(e)
|
||||||
if not unread_count:
|
if not unread_count:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user