Wouldn't this be better to check for exception? ``...
# getting-started
n
Wouldn't this be better to check for exception?
Copy code
fun <T : Throwable> shouldThrow(exception: T, block: () -> Unit) {
    try {
        block()
    } catch (e: T) {
        return
    } catch (e: Exception) {
    }

    throw IllegalStateException()
}