Skip to content

Commit

Permalink
Validate that throwing tryCopy does not crash with an internal error (#…
Browse files Browse the repository at this point in the history
…3063)

Motivated by #3031
  • Loading branch information
qwwdfsad committed Feb 24, 2022
1 parent 83ffd17 commit b545807
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 b545807

Please sign in to comment.