Merge pull request #5656 from FinnStutzenstein/SmtpException
Improve reporting of SMTP exception
This commit is contained in:
commit
d4577ed8aa
@ -515,7 +515,11 @@ class UserViewSet(ModelViewSet):
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
except smtplib.SMTPException as err:
|
except smtplib.SMTPException as err:
|
||||||
raise ValidationError({"detail": f"{err.errno}: {err.strerror}"})
|
if err.errno and err.strerror:
|
||||||
|
detail = f"{err.errno}: {err.strerror}"
|
||||||
|
else:
|
||||||
|
detail = str(err)
|
||||||
|
raise ValidationError({"detail": detail})
|
||||||
|
|
||||||
success_users = []
|
success_users = []
|
||||||
user_pks_without_email = []
|
user_pks_without_email = []
|
||||||
|
Loading…
Reference in New Issue
Block a user