Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stacktrace recovery doesn't filter out exceptions with modified message #2749

Closed
qwwdfsad opened this issue Jun 7, 2021 · 0 comments
Closed
Assignees
Labels

Comments

@qwwdfsad
Copy link
Member

qwwdfsad commented Jun 7, 2021

This is a rarely-reproducing leftover of #1631

Steps to reproduce:

class WrongMessageException(token: String) : RuntimeException("Token $token")

@Test
fun testWrongMessageExceptionInChannel() = runTest {
    // Separate code path
    val result = produce<Unit>(SupervisorJob() + Dispatchers.Unconfined) {
        throw WrongMessageException("OK")
    }
    val ex = runCatching {
        for (unit in result) {
            // Iterator has a special code path
        }
    }.exceptionOrNull() ?: error("Expected to fail")
    assertTrue(ex is WrongMessageException)
    assertEquals("Token OK", ex.message)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant