Improved Debug output on send email
This commit is contained in:
parent
f5e12328dc
commit
33472567de
|
@ -96,7 +96,7 @@ def get_attachment(bookpath, filename):
|
||||||
data = file_.read()
|
data = file_.read()
|
||||||
file_.close()
|
file_.close()
|
||||||
except IOError as e:
|
except IOError as e:
|
||||||
log.exception(e) # traceback.print_exc()
|
log.exception(e)
|
||||||
log.error(u'The requested file could not be read. Maybe wrong permissions?')
|
log.error(u'The requested file could not be read. Maybe wrong permissions?')
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
@ -426,10 +426,6 @@ class WorkerThread(threading.Thread):
|
||||||
if self.last >= 20:
|
if self.last >= 20:
|
||||||
self._delete_completed_tasks()
|
self._delete_completed_tasks()
|
||||||
# progress=100%, runtime=0, and status finished
|
# progress=100%, runtime=0, and status finished
|
||||||
log.debug("Last " + str(self.last))
|
|
||||||
log.debug("Current " + str(self.current))
|
|
||||||
log.debug("id" + str(self.id))
|
|
||||||
|
|
||||||
self.id += 1
|
self.id += 1
|
||||||
starttime = datetime.now()
|
starttime = datetime.now()
|
||||||
self.queue.append({'starttime': starttime, 'taskType': TASK_UPLOAD})
|
self.queue.append({'starttime': starttime, 'taskType': TASK_UPLOAD})
|
||||||
|
@ -501,7 +497,8 @@ class WorkerThread(threading.Thread):
|
||||||
smtplib.stderr = org_smtpstderr
|
smtplib.stderr = org_smtpstderr
|
||||||
|
|
||||||
except (MemoryError) as e:
|
except (MemoryError) as e:
|
||||||
self._handleError(u'Error sending email: ' + e.message)
|
log.exception(e)
|
||||||
|
self._handleError(u'MemoryError sending email: ' + str(e))
|
||||||
return None
|
return None
|
||||||
except (smtplib.SMTPException, smtplib.SMTPAuthenticationError) as e:
|
except (smtplib.SMTPException, smtplib.SMTPAuthenticationError) as e:
|
||||||
if hasattr(e, "smtp_error"):
|
if hasattr(e, "smtp_error"):
|
||||||
|
@ -509,11 +506,12 @@ class WorkerThread(threading.Thread):
|
||||||
elif hasattr(e, "message"):
|
elif hasattr(e, "message"):
|
||||||
text = e.message
|
text = e.message
|
||||||
else:
|
else:
|
||||||
|
log.exception(e)
|
||||||
text = ''
|
text = ''
|
||||||
self._handleError(u'Error sending email: ' + text)
|
self._handleError(u'Smtplib Error sending email: ' + text)
|
||||||
return None
|
return None
|
||||||
except (socket.error) as e:
|
except (socket.error) as e:
|
||||||
self._handleError(u'Error sending email: ' + e.strerror)
|
self._handleError(u'Socket Error sending email: ' + e.strerror)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def _handleError(self, error_message):
|
def _handleError(self, error_message):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user