Mercurial > hg
comparison mercurial/mail.py @ 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 | 6fbbb90261b1 |
children | f0e99a2eac76 |
comparison
equal
deleted
inserted
replaced
9245:d7d3afd935fa | 9246:2de7d96593db |
---|---|
34 if username and not password: | 34 if username and not password: |
35 password = ui.getpass() | 35 password = ui.getpass() |
36 if username and password: | 36 if username and password: |
37 ui.note(_('(authenticating to mail server as %s)\n') % | 37 ui.note(_('(authenticating to mail server as %s)\n') % |
38 (username)) | 38 (username)) |
39 s.login(username, password) | 39 try: |
40 s.login(username, password) | |
41 except smtplib.SMTPException, inst: | |
42 raise util.Abort(inst) | |
40 | 43 |
41 def send(sender, recipients, msg): | 44 def send(sender, recipients, msg): |
42 try: | 45 try: |
43 return s.sendmail(sender, recipients, msg) | 46 return s.sendmail(sender, recipients, msg) |
44 except smtplib.SMTPRecipientsRefused, inst: | 47 except smtplib.SMTPRecipientsRefused, inst: |