diff --git a/maestro-studio/server/src/main/java/maestro/studio/DeviceService.kt b/maestro-studio/server/src/main/java/maestro/studio/DeviceService.kt index a330208a61..1dd05c1ba8 100644 --- a/maestro-studio/server/src/main/java/maestro/studio/DeviceService.kt +++ b/maestro-studio/server/src/main/java/maestro/studio/DeviceService.kt @@ -99,13 +99,15 @@ object DeviceService { } } - private fun executeCommands(maestro: Maestro, commands: List): Throwable? { + private fun executeCommands(maestro: Maestro, commands: List) { var failure: Throwable? = null val result = Orchestra(maestro, onCommandFailed = { _, _, throwable -> failure = throwable Orchestra.ErrorResolution.FAIL }).executeCommands(commands) - return if (result) null else (failure ?: RuntimeException("Command execution failed")) + if (failure != null) { + throw RuntimeException("Command execution failed") + } } private fun treeToElements(tree: TreeNode): List {