Mercurial > public > mercurial-scm > hg
comparison mercurial/mail.py @ 46992:5fa019ceb499
mail: force SMTPException to bytes before wrapping in error.Abort
Pytype wasn't complaining about this for some reason, but PyCharm was and we
already handle another instance of this exception the same way in this function.
Differential Revision: https://phab.mercurial-scm.org/D10473
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Mon, 19 Apr 2021 20:38:52 -0400 |
parents | 83c0d144ef8d |
children | 106402245301 |
comparison
equal
deleted
inserted
replaced
46991:83c0d144ef8d | 46992:5fa019ceb499 |
---|---|
162 return s.sendmail(sender, recipients, msg) | 162 return s.sendmail(sender, recipients, msg) |
163 except smtplib.SMTPRecipientsRefused as inst: | 163 except smtplib.SMTPRecipientsRefused as inst: |
164 recipients = [r[1] for r in inst.recipients.values()] | 164 recipients = [r[1] for r in inst.recipients.values()] |
165 raise error.Abort(b'\n' + b'\n'.join(recipients)) | 165 raise error.Abort(b'\n' + b'\n'.join(recipients)) |
166 except smtplib.SMTPException as inst: | 166 except smtplib.SMTPException as inst: |
167 raise error.Abort(inst) | 167 raise error.Abort(stringutil.forcebytestr(inst)) |
168 | 168 |
169 return send | 169 return send |
170 | 170 |
171 | 171 |
172 def _smtp_login(ui, smtp, mailhost, mailport): | 172 def _smtp_login(ui, smtp, mailhost, mailport): |