Author: hartmannathan
Date: Mon Nov  4 22:02:12 2019
New Revision: 1869378

URL: http://svn.apache.org/viewvc?rev=1869378&view=rev
Log:
mailer.py: Handle otherwise uncaught exception in SMTPOutput.finish

Follow-up on r1869194. That revision addresses issue SVN-1804 by
adding exception handling for SMTP errors, but does not handle a
potential source of exceptions when closing a SMTP session.

* tools/hook-scripts/mailer/mailer.py
  (SMTPOutput.finish): Handle exception that may be raised by
    server.quit.

Found by: futatuki
Review by: futatuki

Modified:
    subversion/trunk/tools/hook-scripts/mailer/mailer.py

Modified: subversion/trunk/tools/hook-scripts/mailer/mailer.py
URL: 
http://svn.apache.org/viewvc/subversion/trunk/tools/hook-scripts/mailer/mailer.py?rev=1869378&r1=1869377&r2=1869378&view=diff
==============================================================================
--- subversion/trunk/tools/hook-scripts/mailer/mailer.py (original)
+++ subversion/trunk/tools/hook-scripts/mailer/mailer.py Mon Nov  4 22:02:12 
2019
@@ -339,7 +339,11 @@ class SMTPOutput(MailedOutput):
       raise
 
     finally:
-      server.quit()
+      try:
+        server.quit()
+      except smtplib.SMTPException as detail:
+        sys.stderr.write("mailer.py: Error occurred during SMTP session 
cleanup: %s\n"
+                             % (detail,))
 
 
 class StandardOutput(OutputBase):


Reply via email to