From 861ce586dc0069f7dc3b1933c474757bb7c5ec0e Mon Sep 17 00:00:00 2001 From: Anton Malinskiy Date: Thu, 22 Aug 2024 17:08:40 +1000 Subject: [PATCH] fix(android): better device failure handling for ScreenRecorder (#968) --- .../com/malinskiy/marathon/android/adam/AdamAndroidDevice.kt | 2 ++ .../marathon/android/executor/listeners/video/ScreenRecorder.kt | 2 ++ 2 files changed, 4 insertions(+) diff --git a/vendor/vendor-android/src/main/kotlin/com/malinskiy/marathon/android/adam/AdamAndroidDevice.kt b/vendor/vendor-android/src/main/kotlin/com/malinskiy/marathon/android/adam/AdamAndroidDevice.kt index 277b2e57d..5fb3739cf 100644 --- a/vendor/vendor-android/src/main/kotlin/com/malinskiy/marathon/android/adam/AdamAndroidDevice.kt +++ b/vendor/vendor-android/src/main/kotlin/com/malinskiy/marathon/android/adam/AdamAndroidDevice.kt @@ -430,8 +430,10 @@ class AdamAndroidDevice( } } catch (e: CancellationException) { logger.warn(e) { "screenrecord start was interrupted" } + throw e } catch (e: Exception) { logger.error("Unable to start screenrecord", e) + throw e } } diff --git a/vendor/vendor-android/src/main/kotlin/com/malinskiy/marathon/android/executor/listeners/video/ScreenRecorder.kt b/vendor/vendor-android/src/main/kotlin/com/malinskiy/marathon/android/executor/listeners/video/ScreenRecorder.kt index d81fcca2a..7faeb8b1f 100644 --- a/vendor/vendor-android/src/main/kotlin/com/malinskiy/marathon/android/executor/listeners/video/ScreenRecorder.kt +++ b/vendor/vendor-android/src/main/kotlin/com/malinskiy/marathon/android/executor/listeners/video/ScreenRecorder.kt @@ -16,8 +16,10 @@ internal class ScreenRecorder( startRecordingTestVideo(remoteFilePath) } catch (e: CancellationException) { logger.warn(e) { "screenrecord start was interrupted" } + throw e } catch (e: Exception) { logger.error("Something went wrong while screen recording", e) + throw e } }