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
Motivated by #3031
  • Loading branch information
qwwdfsad committed Dec 6, 2021
1 parent ec9be92 commit 299c158
Showing 1 changed file with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
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 299c158

Please sign in to comment.