David Kubecka
03/09/2023, 2:15 PMTransactionTemplate(this).execute { return }
If not what are my options? š
Also can anyone explain why that's not technically possible?Sam
03/09/2023, 2:19 PMSam
03/09/2023, 2:20 PMSam
03/09/2023, 2:21 PMSam
03/09/2023, 2:25 PMtry {
TransactionTemplate(this).execute { throw MySpecialException() }
} catch (e: MySpecialException) {
return
}
I say āgrossā because it has some performance impact and it can make the control flow hard to follow. I donāt normally like using exceptions for control flow.Joffrey
03/09/2023, 2:31 PMexecute()
)
One possibly much simpler way would be to use a local return in the lambda. Could you please provide a more realistic code and explain what you're trying to do with it here?David Kubecka
03/09/2023, 2:43 PMephemient
03/09/2023, 3:33 PMephemient
03/09/2023, 3:35 PMthrow scala.runtime.NonLocalReturnException
but that's definitely not something Kotlin should emulate)David Kubecka
03/09/2023, 4:16 PMSam
03/09/2023, 4:27 PMdeive
03/09/2023, 4:45 PM!!
?ephemient
03/09/2023, 4:48 PMdeive
03/09/2023, 5:02 PM