3 ms·
> That you've marked the function `throws E` is an admission it doesn't really work Correct, I didn't spend a lot of time refining it. I suppose the only way t
by azth 5y ago
> That you've marked the function `throws E` is an admission it doesn't really work
Correct, I didn't spend a lot of time refining it. I suppose the only way to make it work is to remove `throws E` from the signature and make it `throw new RuntimeException(e)`, and be similar to C#/Kotlin/Scala.
My last JVM job used Scala, and we wrote things that are similar to
val x = foo() match {
case Success(res) => res
case Error(e) => return quux() // Returns from function scope
}