Improve reporting of SMTP exception
This commit is contained in:
parent
7277a1bb01
commit
1dd86a29be
@ -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