merge
Execute the Raise context function resulting in A or any logical error of type A. Does not distinguish between normal results and errors, thus you can consider return
and raise
to be semantically equivalent inside.
fun test() {
merge { if(Random.nextBoolean()) raise("failed") else "failed" } shouldBe "failed"
}
Content copied to clipboard