We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The source code for util.Try.apply has a catch block
util.Try.apply
catch { case e => Failure(e) }
which will soak up control exceptions. Failure.recover and Success.flatMap have the same problem. The catch block should be
Failure.recover
Success.flatMap
catch { case ct: control.ControlThrowable => throw ct case e => Failure(e) }
If you try to use a return or a break from within these methods, this bug will result in a Failure instead of the desired control flow.
Failure
The text was updated successfully, but these errors were encountered:
Imported From: https://issues.scala-lang.org/browse/SI-5980?orig=1 Reporter: @Ichoran Affected Versions: 2.10.0-M4 See #2807
Sorry, something went wrong.
@retronym said (edited on Jun 25, 2012 9:59:23 PM UTC): Arguably it shouldn't be catching {{Error}}-s, either.
@adriaanm said: scala/scala#830
@Ichoran said: The issue was only partly fixed: Success.flatMap is still (as of 2.10.M6 at least)
def flatMap[U](f: T => Try[U]): Try[U] = try f(value) catch { case e: Throwable => Failure(e) }
which eats control exceptions.
@heathermiller said: It is fixed though in the nightly. scala/scala#1056
@heathermiller said: More precisely: https://github.com/scala/scala/pull/1056/files#L5L209
heathermiller
No branches or pull requests
The source code for
util.Try.apply
has a catch blockwhich will soak up control exceptions.
Failure.recover
andSuccess.flatMap
have the same problem. The catch block should beIf you try to use a return or a break from within these methods, this bug will result in a
Failure
instead of the desired control flow.The text was updated successfully, but these errors were encountered: