From 77b0241406563a562b29dedaaef5a950328c4c1e Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Sat, 5 Sep 2020 09:00:16 +0200 Subject: [PATCH] Log TeX error directly --- apps/treasury/views.py | 4 +++- apps/wei/views.py | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/apps/treasury/views.py b/apps/treasury/views.py index 5889f8b5..2bddf319 100644 --- a/apps/treasury/views.py +++ b/apps/treasury/views.py @@ -217,7 +217,9 @@ class InvoiceRenderView(LoginRequiredMixin, View): ).wait() if error: - raise IOError("An error attempted while generating a invoice (code=" + str(error) + ")") + with open("{}/invoice-{:d}.log".format(tmp_dir, pk), "r") as f: + log = f.read() + raise IOError("An error attempted while generating a invoice (code=" + str(error) + ")\n\n" + log) # Display the generated pdf as a HTTP Response pdf = open("{}/invoice-{}.pdf".format(tmp_dir, pk), 'rb').read() diff --git a/apps/wei/views.py b/apps/wei/views.py index 358cb14a..7720829c 100644 --- a/apps/wei/views.py +++ b/apps/wei/views.py @@ -1110,7 +1110,9 @@ class MemberListRenderView(LoginRequiredMixin, View): ).wait() if error: - raise IOError("An error attempted while generating a WEI list (code=" + str(error) + ")") + with open("{}/wei-list.log".format(tmp_dir), "r") as f: + log = f.read() + raise IOError("An error attempted while generating a WEI list (code=" + str(error) + ")\n\n" + log) # Display the generated pdf as a HTTP Response with open("{}/wei-list.pdf".format(tmp_dir), 'rb') as f: