Skip to content

Commit

Permalink
Validate that throwing tryCopy does not crash with an internal error (K…
Browse files Browse the repository at this point in the history
  • Loading branch information
qwwdfsad authored and pablobaxter committed Sep 14, 2022
1 parent 3c073f6 commit 2e4aaa7
Showing 1 changed file with 18 additions and 0 deletions.
Expand Up @@ -124,4 +124,22 @@ class StackTraceRecoveryCustomExceptionsTest : TestBase() {
assertTrue(ex is CopyableWithCustomMessage)
assertEquals("Recovered: [OK]", ex.message)
}

@Test
fun testTryCopyThrows() = runTest {
class FailingException : Exception(), CopyableThrowable<FailingException> {
override fun createCopy(): FailingException? {
TODO("Not yet implemented")
}
}

val e = FailingException()
val result = runCatching {
coroutineScope<Unit> {
throw e
}
}

assertSame(e, result.exceptionOrNull())
}
}

0 comments on commit 2e4aaa7

Please sign in to comment.