I am developing an android application with kotlin
assistance but the question is based on pure kotlin
fundamentals. Below is the function which is showing some unusual behavior:
fun CatchThat(funct: () -> Unit){
try {
funct()
}catch (ex: Error){
ex.printStackTrace()
}
}
When I use it in my code
CatchThat {
// Proprietary Code goes in here
}
- Debugger does not work properly(sometimes)
- The proprietary code does not execute at all(sometimes)
Why is that behavior encountered or am I getting some concepts wrong(maybe lambdas
). Any help or suggestions are heartily welcomed.(I am a tyro in kotlin
)
EDIT The thing that I am doing in Proprietary code.
I am trying to invoke a Thread Pool
that is in turn calling a web activity. This is the best and all I could explain about it. I am sorry for that.