Catch me if you can, Exception edition

Report a typo
Hey there! This problem might be a bit unpredictable, but give it a go and let us know how you do!
How would you complete the code to demonstrate the hierarchy of exceptions in Kotlin? Fill in the blanks to create a function that catches different types of exceptions in order.
Fill in the gaps with the relevant elements
fun demonstrateExceptionHierarchy() {
     {
         ArithmeticException("Division by zero")
    }  (e: RuntimeException) {
        println("Caught RuntimeException: ${e.message}")
    } catch (e: ) {
        println("Caught Exception: ${e.message}")
    } catch (e: ) {
        println("Caught Throwable: ${e.message}")
    }
}

Create a free account to access the full topic