fun methodWithException() {
try {
throw Exception("test exception")
}
catch (e: Exception) {
//implementation of any partial processing
//and send error to the calling code
throw e
}
}
try {
methodWithException()
}
catch (e: Exception) {
println(e.message);
}