From 79f5afae30243720b22dae200c0f509c8753d3c5 Mon Sep 17 00:00:00 2001
From: Dominik George <dominik.george@teckids.org>
Date: Tue, 6 Oct 2020 11:56:43 +0200
Subject: [PATCH] Raise proper exception, and early, if XML parsing fails

---
 bigbluebutton/api/bigbluebutton.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/bigbluebutton/api/bigbluebutton.py b/bigbluebutton/api/bigbluebutton.py
index aec5215..94e5f56 100644
--- a/bigbluebutton/api/bigbluebutton.py
+++ b/bigbluebutton/api/bigbluebutton.py
@@ -142,7 +142,10 @@ class BigBlueButton:
         if res.status_code != 200:
             raise BigBlueButtonError(f"Backend returned HTTP status {res.status_code}.")
 
-        xml = xmltodict.parse(res.text)
+        try:
+            xml = xmltodict.parse(res.text)
+        except Exception as ex:
+            raise BigBlueButtonError("Failed to parse XML response from backend.") from ex
 
         return xml["response"]
 
-- 
GitLab