From d84f30287a0a5294290739b55539c3b0303674c9 Mon Sep 17 00:00:00 2001 From: Phuoc CAO Date: Mon, 15 May 2023 18:27:26 +0200 Subject: [PATCH] log only first 400 char of error text --- mondumas/views/utils.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/mondumas/views/utils.py b/mondumas/views/utils.py index 06305a8..5d4cf1c 100644 --- a/mondumas/views/utils.py +++ b/mondumas/views/utils.py @@ -172,10 +172,7 @@ def send_mail(request, expediteur, destinataires, objet, corps): except Exception as e: # Just print(e) is cleaner and more likely what you want, # but if you insist on printing message specifically whenever possible... - if hasattr(e, 'message'): - msg = e.message[0:400] - else: - msg = e[0:400] + msg = repr(e)[0:400] insert_log(request, 'MAILER', "- ERROR : %s, TO : %s" % (msg, destinataires)) return str(msg)