mirror of
https://github.com/priyanshujain/sanderling.git
synced 2026-10-03 03:27:10 +00:00
fix(sidecar): walk cause chain in withReconnect to catch Maestro-wrapped IOException
This commit is contained in:
1 parent
0f1f3eb457
commit
665831ffd7
1 file changed
+6
-5
@@ -530,11 +530,12 @@ class IosDriverBackend(private val udid: String) : DriverBackend {
|
||||
private fun <T> withReconnect(block: () -> T): T {
|
||||
return try {
|
||||
block()
|
||||
} catch (e: java.io.IOException) {
|
||||
try {
|
||||
driver.open()
|
||||
warmup()
|
||||
} catch (reconnectErr: Exception) {
|
||||
} catch (e: Exception) {
|
||||
val isIoFailure = generateSequence(e as Throwable) { it.cause }
|
||||
.any { it is java.io.IOException }
|
||||
if (!isIoFailure) throw e
|
||||
try { driver.open(); warmup() }
|
||||
catch (reconnectErr: Exception) {
|
||||
throw IllegalStateException("WDA reconnect failed: $reconnectErr", e)
|
||||
}
|
||||
block()
|
||||
|
||||
Reference in new issue
Block a user