Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
video_calls: Fix crash on errors raised before getting a response.
Anders Kaseorg48f515958707
diff --git a/zerver/tests/test_create_video_call.py b/zerver/tests/test_create_video_call.pyindex 844ba9e01ee..1a8c7942864 100644--- a/zerver/tests/test_create_video_call.py+++ b/zerver/tests/test_create_video_call.py@@ -677,6 +677,24 @@ class BigBlueButtonVideoCallTest(ZulipTestCase):response, "Error connecting to the BigBlueButton server: Connection refused")+ @responses.activate+ def test_join_bigbluebutton_too_many_redirects(self) -> None:+ url = "https://bbb.example.com/bigbluebutton/api/create?meetingID=a&name=a&lockSettingsDisableCam=True&checksum=33349e6374ca9b2d15a0c6e51a42bc3e8f770de13f88660815c6449859856e20"+ responses.add(+ responses.GET,+ url,+ status=302,+ headers={"Location": url},+ body="Redirecting",+ )+ response = self.client_get(+ "/calls/bigbluebutton/join",+ {"bigbluebutton": self.signed_bbb_a_object},+ )+ self.assert_json_error(+ response, "Error connecting to the BigBlueButton server: HTTP 302: Redirecting"+ )+@responses.activatedef test_join_bigbluebutton_redirect_error_by_server(self) -> None:# Simulate bbb server errordiff --git a/zerver/views/video_calls.py b/zerver/views/video_calls.pyindex 16df8fd5349..26145478e2f 100644--- a/zerver/views/video_calls.py+++ b/zerver/views/video_calls.py@@ -644,7 +644,7 @@ def join_bigbluebutton(request: HttpRequest, *, bigbluebutton: str) -> HttpResporesponse.raise_for_status()except requests.RequestException as e:if e.response is not None:- reason = f"HTTP {response.status_code}: {response.text:.200}"+ reason = f"HTTP {e.response.status_code}: {e.response.text:.200}"else:reason = str(e)raise VideoCallServerConnectionError("BigBlueButton", reason=reason)@@ -751,7 +751,7 @@ def create_nextcloud_talk_url(response.raise_for_status()except requests.RequestException as e:if e.response is not None:- reason = f"HTTP {response.status_code}: {response.text:.200}"+ reason = f"HTTP {e.response.status_code}: {e.response.text:.200}"else:reason = str(e)raise VideoCallServerConnectionError("Nextcloud Talk", reason=reason)