kotlin throw exception
snippet in kotlin

Kotlin try

user2463

try {
    // some code
}
catch (e: SomeException) {
    // handler
}
finally {
    // optional finally block
}

Kotlin throws

user6541

@Throws(SomeException::class)
fun raise() {
	throw SomeException("Mwehp!")
}

kotlin throw exception

user978

throw Exception("Exception message")