changeset 9246:2de7d96593db

email: Catch exceptions during send. Catch SMTPlib exceptions to avoid mercurial showing a backtrace during an e.g. authentication error.
author David Soria Parra <dsp@php.net>
date Mon, 27 Jul 2009 02:27:24 +0200
parents d7d3afd935fa
children ac02b43bc08a b3ee4c2e1ff5
files mercurial/mail.py
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/mail.py	Sat Jul 25 19:04:08 2009 -0500
+++ b/mercurial/mail.py	Mon Jul 27 02:27:24 2009 +0200
@@ -36,7 +36,10 @@
     if username and password:
         ui.note(_('(authenticating to mail server as %s)\n') %
                   (username))
-        s.login(username, password)
+        try:
+            s.login(username, password)
+        except smtplib.SMTPException, inst:
+            raise util.Abort(inst)
 
     def send(sender, recipients, msg):
         try: