From 738ea70c5ef9b98b1a111f8e19ecf0bb92286378 Mon Sep 17 00:00:00 2001 From: Liviu Timar <65943217+liviu-timar@users.noreply.github.com> Date: Mon, 8 Jul 2024 16:54:40 +0300 Subject: [PATCH] Handle RtcSession timeout exception properly (#1136) * Catch exceptions when joining call * Revert "Catch exceptions when joining call" This reverts commit 6e00a810a79b334df504e3b057948d0def1e9a1b. * Catch RTC exceptions in _join() and return Failure result --- .../kotlin/io/getstream/video/android/core/Call.kt | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/Call.kt b/stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/Call.kt index d83f433d37..ecd163873c 100644 --- a/stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/Call.kt +++ b/stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/Call.kt @@ -426,9 +426,13 @@ public class Call( } timer.split("rtc session init") - session?.connect() - - timer.split("rtc connect completed") + try { + session?.connect() + } catch (e: Exception) { + return Failure(Error.GenericError(e.message ?: "RtcSession error occurred.")) + } finally { + timer.split("rtc connect completed") + } scope.launch { // wait for the first stream to be added