commit | 28348e43aee99b159746d0e28e1814d25d25bffc | [log] [tgz] |
---|---|---|
author | Chalard Jean <jchalard@google.com> | Wed Nov 24 17:34:53 2021 +0900 |
committer | Chalard Jean <jchalard@google.com> | Thu Nov 25 16:26:42 2021 +0900 |
tree | c7f363c93c874adf0841ec70b9d2f0636fdeb98d | |
parent | 2918ada95870dcdd7acdb42520929880c89921df [diff] |
Have tryTest{} work with throwables Test: NetworkStaticLibTests Change-Id: I9ee52e7d34866c82e169bbecbca3f928bfd79993
diff --git a/staticlibs/testutils/hostdevice/com/android/testutils/Cleanup.kt b/staticlibs/testutils/hostdevice/com/android/testutils/Cleanup.kt index 22b9b6c..eec8128 100644 --- a/staticlibs/testutils/hostdevice/com/android/testutils/Cleanup.kt +++ b/staticlibs/testutils/hostdevice/com/android/testutils/Cleanup.kt
@@ -84,7 +84,7 @@ inline infix fun cleanup(block: () -> Unit): T { try { block() - } catch (e: Exception) { + } catch (e: Throwable) { val originalException = result.exceptionOrNull() if (null == originalException) { throw e @@ -101,7 +101,7 @@ fun <T> tryTest(block: () -> T) = TryExpr( try { Result.success(block()) - } catch (e: Exception) { + } catch (e: Throwable) { Result.failure(e) })