summaryrefslogtreecommitdiff
path: root/src/library
diff options
context:
space:
mode:
authorMiles Sabin <miles@milessabin.com>2009-07-15 13:01:43 +0000
committerMiles Sabin <miles@milessabin.com>2009-07-15 13:01:43 +0000
commit69e1ddb55a7f122715dbed337de73f595ae00dc3 (patch)
treec545190e2d2a79070ac49e76886bdca34f94bdba /src/library
parent370817ac9736f67775a150f679bb5a4c01356ecb (diff)
downloadscala-69e1ddb55a7f122715dbed337de73f595ae00dc3.tar.gz
scala-69e1ddb55a7f122715dbed337de73f595ae00dc3.tar.bz2
scala-69e1ddb55a7f122715dbed337de73f595ae00dc3.zip
Added ControlException marker trait and update ...
Added ControlException marker trait and update various exceptions to mix it in; the typer now correctly propagates ControlExceptions rather than reporting them; the IDE reports attempts to log ControlExceptions; Global.signalDone no longer leaks ValidateErrors back into the typer; the set of compiler options offered by the IDE has been updated.
Diffstat (limited to 'src/library')
-rw-r--r--src/library/scala/runtime/NonLocalReturnException.scala3
-rwxr-xr-xsrc/library/scala/util/control/Breaks.scala2
-rw-r--r--src/library/scala/util/control/ControlException.scala39
3 files changed, 42 insertions, 2 deletions
diff --git a/src/library/scala/runtime/NonLocalReturnException.scala b/src/library/scala/runtime/NonLocalReturnException.scala
index 7bb7b99341..2884a0ce9f 100644
--- a/src/library/scala/runtime/NonLocalReturnException.scala
+++ b/src/library/scala/runtime/NonLocalReturnException.scala
@@ -13,8 +13,9 @@ package scala.runtime
import Predef.RuntimeException
+import scala.util.control.ControlException
-class NonLocalReturnException[T](val key: AnyRef, val value: T) extends RuntimeException {
+class NonLocalReturnException[T](val key: AnyRef, val value: T) extends RuntimeException with ControlException {
/*
* For efficiency reasons we do not fill in
* the execution stack trace.
diff --git a/src/library/scala/util/control/Breaks.scala b/src/library/scala/util/control/Breaks.scala
index 3315140b6b..25adf80573 100755
--- a/src/library/scala/util/control/Breaks.scala
+++ b/src/library/scala/util/control/Breaks.scala
@@ -44,5 +44,5 @@ class Breaks {
/** A singleton object providing the Break functionality */
object Breaks extends Breaks
-private class BreakException extends RuntimeException
+private class BreakException extends RuntimeException with ControlException
diff --git a/src/library/scala/util/control/ControlException.scala b/src/library/scala/util/control/ControlException.scala
new file mode 100644
index 0000000000..4ac7b0ceeb
--- /dev/null
+++ b/src/library/scala/util/control/ControlException.scala
@@ -0,0 +1,39 @@
+/* __ *\
+** ________ ___ / / ___ Scala API **
+** / __/ __// _ | / / / _ | (c) 2003-2009, LAMP/EPFL **
+** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
+** /____/\___/_/ |_/____/_/ | | **
+** |/ **
+\* */
+
+// $Id$
+
+package scala.util.control
+
+/**
+ * A marker trait indicating that the <code>Throwable</code> it is mixed
+ * into is intended for flow control.
+ *
+ * <p>Note that <code>Throwable</code> subclasses which extend this trait
+ * may extend any other <code>Throwable</code> subclass (eg.
+ * <code>RuntimeException</code>) and are not required to extend
+ * <code>Throwable</code> directly.</p>
+ *
+ * <p>Instances of <code>Throwable</code> subclasses marked in
+ * this way should not normally be caught. Where catch-all behaviour is
+ * required <code>ControlException</code>s should be propagated, for
+ * example,</p>
+ *
+ * <pre>
+ * import scala.util.control.ControlException
+ *
+ * try {
+ * // Body might throw arbitrarily
+ * } catch {
+ * case ce : ControlException => throw ce // propagate
+ * case t : Exception => log(t) // log and suppress
+ * </pre>
+ *
+ * @author Miles Sabin
+ */
+trait ControlException extends Throwable