exception handling in kotlin code example
Example 1: kotlin try catch
try {
// some code
}
catch (e: SomeException) {
// handler
}
finally {
// optional finally block
}
Example 2: kotlin throw exception
throw Exception("Exception message")