summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/files/jvm/actor-uncaught-exception2.check2
-rw-r--r--test/files/jvm/actor-uncaught-exception2.scala48
2 files changed, 50 insertions, 0 deletions
diff --git a/test/files/jvm/actor-uncaught-exception2.check b/test/files/jvm/actor-uncaught-exception2.check
new file mode 100644
index 0000000000..870a5d32f9
--- /dev/null
+++ b/test/files/jvm/actor-uncaught-exception2.check
@@ -0,0 +1,2 @@
+UncaughtException(StartError,None,None,MyException: I don't want to run!)
+UncaughtException(MessageError,Some('ping),Some(Supervisor),MyException: No message for me!)
diff --git a/test/files/jvm/actor-uncaught-exception2.scala b/test/files/jvm/actor-uncaught-exception2.scala
new file mode 100644
index 0000000000..973cfb370a
--- /dev/null
+++ b/test/files/jvm/actor-uncaught-exception2.scala
@@ -0,0 +1,48 @@
+import scala.actors.{Actor, Exit, Debug}
+
+class MyException(msg: String) extends Exception(msg) {
+ override def fillInStackTrace() = this
+}
+
+object Test {
+
+ case object StartError extends Actor {
+ def act() {
+ throw new MyException("I don't want to run!")
+ }
+ }
+
+ case object MessageError extends Actor {
+ def act() {
+ react {
+ case _ => throw new MyException("No message for me!")
+ }
+ }
+ }
+
+ case object Supervisor extends Actor {
+ def act() {
+ trapExit = true
+ link(StartError)
+ link(MessageError)
+ StartError.start()
+ MessageError.start()
+
+ Actor.loop {
+ react {
+ case Exit(actor, reason) =>
+ println(reason)
+ if (actor == StartError)
+ MessageError ! 'ping
+ else
+ exit()
+ }
+ }
+ }
+ }
+
+ def main(args: Array[String]) {
+ Debug.level = 1 // decrease level so that it does not print warnings
+ Supervisor.start()
+ }
+}