imap - Catch socket.gaierror if no internet connection is available
This commit is contained in:
parent
b4e21dfd9e
commit
1b6dd7ea33
@ -54,8 +54,13 @@ class IMAP(Backend):
|
||||
|
||||
@property
|
||||
def unread(self):
|
||||
try:
|
||||
conn = self.get_connection()
|
||||
except socket.gaierror:
|
||||
pass
|
||||
else:
|
||||
self.last = len(conn.search(None, "UnSeen")[1][0].split())
|
||||
finally:
|
||||
return self.last
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user