From 938bc683833a7ca239997ec97a96a46c13029738 Mon Sep 17 00:00:00 2001 From: Stranck Date: Fri, 10 May 2024 21:51:14 +0200 Subject: [PATCH] Added extra log in case of generic errors in update answers --- ext.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/ext.py b/ext.py index 35aa170..dd36d32 100644 --- a/ext.py +++ b/ext.py @@ -222,9 +222,13 @@ class Order: res = await pretixClient.patch(f'orderpositions/{self.position_id}/', json={'answers': self.answers}, expectedStatusCodes=None) if res.status_code != 200: - for ans, err in zip(self.answers, res.json()['answers']): - if err: - logger.error ('[ANSWERS SENDING] ERROR ON %s %s', ans, err) + e = res.json() + if "answers" in e: + for ans, err in zip(self.answers, res.json()['answers']): + if err: + logger.error ('[ANSWERS SENDING] ERROR ON %s %s', ans, err) + else: + logger.error("[ANSWERS SENDING] GENERIC ERROR. Response: '%s'", str(e)) raise exceptions.ServerError('There has been an error while updating this answers.')