in robot-server-core/src/main/kotlin/com/intellij/remoterobot/services/IdeRobot.kt [323:341]
fun retrieveAny(script: String, runInEdt: Boolean): Result<Serializable> {
return getResult(RobotContext(robot)) { ctx ->
if (runInEdt) {
runInEdtWithWIL {
val result = jsExecutor.execute(script, ctx)
if (result != null && result is Serializable) {
return@runInEdtWithWIL result
}
throw ScriptMustReturnSerializableException(result)
}
} else {
val result = jsExecutor.execute(script, ctx)
if (result != null && result is Serializable) {
return@getResult result as Serializable
}
throw ScriptMustReturnSerializableException(result)
}
}
}