bbaldino
shouldThrow<SomeException>
SomeException
shouldThrow
sealed class MyException : Exception() { sealed class SubException : MyException() { class SubSubException : SubException() } } inline fun <reified T : Throwable> baz() { try { throw MyException.SubException.SubSubException() } catch (t: Throwable) { when (t) { is T -> { println("my exception thrown!") } else -> { println("don't recognize it!") } } } }
my exception thrown!
LeoColman
A modern programming language that makes developers happier.