[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [bridgedb/develop] Add try/except around parent class errback call in SMTPAutoresponder.



commit 9861fdf7ebcc5fdfe613a9600e0273615e1a4255
Author: Isis Lovecruft <isis@xxxxxxxxxxxxxx>
Date:   Wed Jun 4 17:15:53 2014 +0000

    Add try/except around parent class errback call in SMTPAutoresponder.
---
 lib/bridgedb/email/autoresponder.py |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/lib/bridgedb/email/autoresponder.py b/lib/bridgedb/email/autoresponder.py
index d5dadae..41e811b 100644
--- a/lib/bridgedb/email/autoresponder.py
+++ b/lib/bridgedb/email/autoresponder.py
@@ -531,8 +531,14 @@ class SMTPAutoresponder(smtp.SMTPClient):
             error = fail
         logging.error(error)
 
-        # This handles QUIT commands, disconnecting, and closing the transport:
-        smtp.SMTPClient.sendError(self, fail)
+        try:
+            # This handles QUIT commands, disconnecting, and closing the
+            # transport:
+            smtp.SMTPClient.sendError(self, fail)
+        # We might not have `transport` and `protocol` attributes, depending
+        # on when and where the error occurred, so just catch and log it:
+        except Exception as error:
+            logging.error(error)
 
     def reply(self):
         """Reply to an incoming email. Maybe.



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits