Skip to content

Commit 138f5f2

Browse files
authored
Pass failing commands via studio API (#2140)
fix: throw command execution exception (#1617)
1 parent 755216c commit 138f5f2

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

maestro-studio/server/src/main/java/maestro/studio/DeviceService.kt

+4-2
Original file line numberDiff line numberDiff line change
@@ -104,13 +104,15 @@ object DeviceService {
104104
}
105105
}
106106

107-
private fun executeCommands(maestro: Maestro, commands: List<MaestroCommand>): Throwable? {
107+
private fun executeCommands(maestro: Maestro, commands: List<MaestroCommand>) {
108108
var failure: Throwable? = null
109109
val result = Orchestra(maestro, onCommandFailed = { _, _, throwable ->
110110
failure = throwable
111111
Orchestra.ErrorResolution.FAIL
112112
}).executeCommands(commands)
113-
return if (result) null else (failure ?: RuntimeException("Command execution failed"))
113+
if (failure != null) {
114+
throw RuntimeException("Command execution failed")
115+
}
114116
}
115117

116118
private fun treeToElements(tree: TreeNode): List<UIElement> {

0 commit comments

Comments
 (0)