diff --git a/vector/src/main/java/im/vector/app/features/voicebroadcast/usecase/PauseVoiceBroadcastUseCase.kt b/vector/src/main/java/im/vector/app/features/voicebroadcast/usecase/PauseVoiceBroadcastUseCase.kt index eaa7392140..8f61284423 100644 --- a/vector/src/main/java/im/vector/app/features/voicebroadcast/usecase/PauseVoiceBroadcastUseCase.kt +++ b/vector/src/main/java/im/vector/app/features/voicebroadcast/usecase/PauseVoiceBroadcastUseCase.kt @@ -33,8 +33,8 @@ class PauseVoiceBroadcastUseCase @Inject constructor( private val session: Session, ) { - suspend fun execute(roomId: String) { - val room = session.getRoom(roomId) ?: return + suspend fun execute(roomId: String): Result = runCatching { + val room = session.getRoom(roomId) ?: error("Unknown roomId: $roomId") Timber.d("## PauseVoiceBroadcastUseCase: Pause voice broadcast requested") diff --git a/vector/src/main/java/im/vector/app/features/voicebroadcast/usecase/ResumeVoiceBroadcastUseCase.kt b/vector/src/main/java/im/vector/app/features/voicebroadcast/usecase/ResumeVoiceBroadcastUseCase.kt index 645496bd7d..d0d82b42c3 100644 --- a/vector/src/main/java/im/vector/app/features/voicebroadcast/usecase/ResumeVoiceBroadcastUseCase.kt +++ b/vector/src/main/java/im/vector/app/features/voicebroadcast/usecase/ResumeVoiceBroadcastUseCase.kt @@ -33,8 +33,8 @@ class ResumeVoiceBroadcastUseCase @Inject constructor( private val session: Session, ) { - suspend fun execute(roomId: String) { - val room = session.getRoom(roomId) ?: return + suspend fun execute(roomId: String): Result = runCatching { + val room = session.getRoom(roomId) ?: error("Unknown roomId: $roomId") Timber.d("## ResumeVoiceBroadcastUseCase: Resume voice broadcast requested") diff --git a/vector/src/main/java/im/vector/app/features/voicebroadcast/usecase/StartVoiceBroadcastUseCase.kt b/vector/src/main/java/im/vector/app/features/voicebroadcast/usecase/StartVoiceBroadcastUseCase.kt index dd7bb8cdf4..0b8328cd4b 100644 --- a/vector/src/main/java/im/vector/app/features/voicebroadcast/usecase/StartVoiceBroadcastUseCase.kt +++ b/vector/src/main/java/im/vector/app/features/voicebroadcast/usecase/StartVoiceBroadcastUseCase.kt @@ -32,8 +32,8 @@ class StartVoiceBroadcastUseCase @Inject constructor( private val session: Session, ) { - suspend fun execute(roomId: String) { - val room = session.getRoom(roomId) ?: return + suspend fun execute(roomId: String): Result = runCatching { + val room = session.getRoom(roomId) ?: error("Unknown roomId: $roomId") Timber.d("## StartVoiceBroadcastUseCase: Start voice broadcast requested") diff --git a/vector/src/main/java/im/vector/app/features/voicebroadcast/usecase/StopVoiceBroadcastUseCase.kt b/vector/src/main/java/im/vector/app/features/voicebroadcast/usecase/StopVoiceBroadcastUseCase.kt index dee822e880..8b22193770 100644 --- a/vector/src/main/java/im/vector/app/features/voicebroadcast/usecase/StopVoiceBroadcastUseCase.kt +++ b/vector/src/main/java/im/vector/app/features/voicebroadcast/usecase/StopVoiceBroadcastUseCase.kt @@ -33,8 +33,8 @@ class StopVoiceBroadcastUseCase @Inject constructor( private val session: Session, ) { - suspend fun execute(roomId: String) { - val room = session.getRoom(roomId) ?: return + suspend fun execute(roomId: String): Result = runCatching { + val room = session.getRoom(roomId) ?: error("Unknown roomId: $roomId") Timber.d("## StopVoiceBroadcastUseCase: Stop voice broadcast requested")