summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosh Suereth <Joshua.Suereth@gmail.com>2012-08-23 00:34:43 -0700
committerJosh Suereth <Joshua.Suereth@gmail.com>2012-08-23 00:34:43 -0700
commit79f4d775f9aab0e5c3e6af2ea078366ad4774929 (patch)
tree740a7f56230448fa8926368096cf1f763a0b8805
parent6e344bc3d323a42589f8bd6f74af623a87b573db (diff)
parente512d1aead7afdca8748cfaced3d707a23d528c3 (diff)
downloadscala-79f4d775f9aab0e5c3e6af2ea078366ad4774929.tar.gz
scala-79f4d775f9aab0e5c3e6af2ea078366ad4774929.tar.bz2
scala-79f4d775f9aab0e5c3e6af2ea078366ad4774929.zip
Merge pull request #1183 from jsuereth/fix/try-catch-inversion
Fix stupid logic inversion of try-catch
-rw-r--r--src/library/scala/util/control/Exception.scala2
-rw-r--r--test/files/run/try-catch-unify.check1
-rw-r--r--test/files/run/try-catch-unify.scala1
3 files changed, 3 insertions, 1 deletions
diff --git a/src/library/scala/util/control/Exception.scala b/src/library/scala/util/control/Exception.scala
index 4a5209ecab..1567e06c22 100644
--- a/src/library/scala/util/control/Exception.scala
+++ b/src/library/scala/util/control/Exception.scala
@@ -145,7 +145,7 @@ object Exception {
}
final val nothingCatcher: Catcher[Nothing] = mkThrowableCatcher(_ => false, throw _)
- final def nonFatalCatcher[T]: Catcher[T] = mkThrowableCatcher({ case NonFatal(_) => false; case _ => true }, throw _)
+ final def nonFatalCatcher[T]: Catcher[T] = mkThrowableCatcher({ case NonFatal(_) => true; case _ => false }, throw _)
final def allCatcher[T]: Catcher[T] = mkThrowableCatcher(_ => true, throw _)
/** The empty `Catch` object. */
diff --git a/test/files/run/try-catch-unify.check b/test/files/run/try-catch-unify.check
index b1de2bfa74..67a8c64a33 100644
--- a/test/files/run/try-catch-unify.check
+++ b/test/files/run/try-catch-unify.check
@@ -1,3 +1,4 @@
Failure(java.lang.NumberFormatException: For input string: "Hi")
Success(5.0)
O NOES
+Failure(java.lang.NumberFormatException: For input string: "Hi")
diff --git a/test/files/run/try-catch-unify.scala b/test/files/run/try-catch-unify.scala
index 0d819ab957..8cb14d060e 100644
--- a/test/files/run/try-catch-unify.scala
+++ b/test/files/run/try-catch-unify.scala
@@ -11,5 +11,6 @@ object Test {
} catch {
case t => println(t.getMessage)
}
+ println(nonFatalCatch withTry ("Hi".toDouble))
}
}