Skip to content

Commit

Permalink
🐛 fix email not exists
Browse files Browse the repository at this point in the history
  • Loading branch information
k8scat committed Feb 8, 2021
1 parent 166e4c0 commit 5d795d6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 28 deletions.
26 changes: 0 additions & 26 deletions .github/workflows/lint.yaml

This file was deleted.

11 changes: 9 additions & 2 deletions formair/pop3.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,15 @@ def list_all_emails(self) -> list:
return emails

def get_email(self, index: int) -> dict:
resp, lines, octets = self.server.retr(index)
assert resp.startswith(self.status_ok), f'get email failed: {resp}'
try:
resp, lines, octets = self.server.retr(index)
except Exception as e:
logging.error('get email failed: %s', e)
return None

if not resp.startswith(self.status_ok):
logging.error('get email failed: %s', resp)
return None
logging.info('email size: %d', octets)

# print(lines)
Expand Down

0 comments on commit 5d795d6

Please sign in to comment.