From 80d4b75f1e0418fa4592256d27065971656c1c3e Mon Sep 17 00:00:00 2001 From: Cleo Andersen Date: Tue, 17 Feb 2026 18:45:13 -0800 Subject: [PATCH] Fix error propagation in LiveKit backend --- .../components/voip_room/matrix_livekit_backend.dart | 9 +++------ .../components/voip_room/matrix_voip_room_component.dart | 2 +- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/commet/lib/client/matrix/components/voip_room/matrix_livekit_backend.dart b/commet/lib/client/matrix/components/voip_room/matrix_livekit_backend.dart index c4da607a9..f7580ee8c 100644 --- a/commet/lib/client/matrix/components/voip_room/matrix_livekit_backend.dart +++ b/commet/lib/client/matrix/components/voip_room/matrix_livekit_backend.dart @@ -103,8 +103,7 @@ class MatrixLivekitBackend { final fociUrl = await getFociUrl(); if (fociUrl.isEmpty) { - Log.e("Failed to find a valid LiveKit service"); - return null; + throw Exception("Failed to find a valid LiveKit service"); } final selectedFocus = fociUrl.first; @@ -114,8 +113,7 @@ class MatrixLivekitBackend { .requestOpenIdToken(room.matrixRoom.client.userID!, {}); if (selectedFocus.scheme != "https") { - Log.e("Selected focus jwt does not use https"); - return null; + throw Exception("Selected focus JWT does not use HTTPS"); } Log.d("Received token from homeserver: ${token}"); @@ -133,8 +131,7 @@ class MatrixLivekitBackend { var result = await http.post(uri, body: jsonEncode(body)); if (result.statusCode != 200) { - Log.e("Failed to get sfu!"); - return null; + throw Exception("Failed to get sfu! HTTP Error ${result.statusCode}"); } var data = jsonDecode(result.body) as Map; diff --git a/commet/lib/client/matrix/components/voip_room/matrix_voip_room_component.dart b/commet/lib/client/matrix/components/voip_room/matrix_voip_room_component.dart index aacaf8583..502b1cf44 100644 --- a/commet/lib/client/matrix/components/voip_room/matrix_voip_room_component.dart +++ b/commet/lib/client/matrix/components/voip_room/matrix_voip_room_component.dart @@ -78,7 +78,7 @@ class MatrixVoipRoomComponent @override Future joinCall() async { currentSession = await backend.join(); - currentSession!.onStateChanged.listen(onStateChanged); + currentSession?.onStateChanged.listen(onStateChanged); return currentSession; }