add some nicer error handling

workspace
Brendan Howell 4 years ago
parent 0b503594e4
commit a918438b62

@ -81,6 +81,10 @@ class MailRoom(Bureau):
self.imapserv = imapclient.IMAPClient(self.host, use_uid=True, ssl=self.imap_ssl)
self.imapserv.login(self.login, self.password)
self.imapserv.select_folder("INBOX")
except self.imapserv.Error as err:
self.log.debug("IMAP connection error: %err", err)
self.smprint("IMAP connection error: " + str(err))
def _make_msg_object(self, imap_id, resp_obj):
"""

@ -147,8 +147,13 @@ class Publications(Bureau):
try:
resp = requests.get(url, timeout=20.0, headers=headers)
except requests.ReadTimeout:
self.log.warning("Timeout reading RSS feed %s", url)
return # TODO: do we need to spit out an error?
self.log.warning("Timeout reading url %s", url)
self.print_small("Error: timed out reading " + url)
return
except requests.ConnectionError as e:
self.log.warning("Error reading url %s", url)
self.print_small("Error: connect error on " + url)
return
# re-render with readability
doc = readability.Document(resp.text,

Loading…
Cancel
Save