From b2bc8e654efae0b94185960a65273ed410cf8874 Mon Sep 17 00:00:00 2001 From: Jonathan Sandoval Date: Fri, 8 Apr 2016 13:21:31 -0500 Subject: [PATCH] Include original error in debug log --- mediagoblin/tools/mail.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mediagoblin/tools/mail.py b/mediagoblin/tools/mail.py index 8161a324..3dc180d8 100644 --- a/mediagoblin/tools/mail.py +++ b/mediagoblin/tools/mail.py @@ -115,22 +115,22 @@ def send_email(from_addr, to_addrs, subject, message_body): mhost = smtp_init( mg_globals.app_config['email_smtp_host'], mg_globals.app_config['email_smtp_port']) - except socket.error: + except socket.error as original_error: error_message = "Couldn't contact mail server on <{}>:<{}>".format( mg_globals.app_config['email_smtp_host'], mg_globals.app_config['email_smtp_port']) - logging.debug(error_message) + logging.debug(original_error) raise NoSMTPServerError(error_message) # SMTP.__init__ Issues SMTP.connect implicitly if host if not mg_globals.app_config['email_smtp_host']: # e.g. host = '' try: mhost.connect() # We SMTP.connect explicitly - except socket.error: + except socket.error as original_error: error_message = "Couldn't contact mail server on <{}>:<{}>".format( mg_globals.app_config['email_smtp_host'], mg_globals.app_config['email_smtp_port']) - logging.debug(error_message) + logging.debug(original_error) raise NoSMTPServerError(error_message) try: -- 2.25.1