From: Jonathan Sandoval Date: Fri, 8 Apr 2016 18:21:31 +0000 (-0500) Subject: Include original error in debug log X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=b2bc8e654efae0b94185960a65273ed410cf8874;p=mediagoblin.git Include original error in debug log --- 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: