So this function has some very weird behavior.
fun tryCatch(f: () -> Unit){
try {
f()
}catch (e: Error){
e.printStackTrace()
}
}
When i use it in my code
tryCatch {
//code
}
- The debugger never stops on breakpoints inside this closure
- sometimes the lines where the debugger stops are completely off code
- sometimes the code inside is never executed
Am i not understanding something crucial about Kotlin and lambdas?
Can it be so that each line in the closure is executed in its own try {} catch {}?