Commit acddcf78 authored by Carine Dengler's avatar Carine Dengler
Browse files

fix: catch autentication exception

--HG--
branch : 3.25
parent a91f1eff6e59
...@@ -189,7 +189,7 @@ from os.path import (exists, join, expanduser, abspath, normpath, ...@@ -189,7 +189,7 @@ from os.path import (exists, join, expanduser, abspath, normpath,
import pkgutil import pkgutil
import pkg_resources import pkg_resources
import re import re
from smtplib import SMTP from smtplib import SMTP, SMTPAuthenticationError
import stat import stat
import sys import sys
from threading import Lock from threading import Lock
...@@ -1408,8 +1408,14 @@ the repository', ...@@ -1408,8 +1408,14 @@ the repository',
try: try:
try: try:
smtp = SMTP(server, port) smtp = SMTP(server, port)
if smtp_user and smtp_password: try:
smtp.login(smtp_user, smtp_password) if smtp_user and smtp_password:
smtp.login(smtp_user, smtp_password)
except SMTPAuthenticationError as exception:
self.exception(
"cannot log in to SMTP server %s:%s (%s)",
server, port, exception
)
except Exception as ex: except Exception as ex:
self.exception("can't connect to smtp server %s:%s (%s)", self.exception("can't connect to smtp server %s:%s (%s)",
server, port, ex) server, port, ex)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment