diff options
author | Philipp Haller <hallerp@gmail.com> | 2010-04-29 09:00:51 +0000 |
---|---|---|
committer | Philipp Haller <hallerp@gmail.com> | 2010-04-29 09:00:51 +0000 |
commit | 151d1ec5790556fcf20d60fc48be4ab926360b59 (patch) | |
tree | 2599ba8310bac2e8e273bf94c03aa3da94db9b6f | |
parent | 8f2d31cbcdd9a99195a554d9c9063a79c38b9444 (diff) | |
download | scala-151d1ec5790556fcf20d60fc48be4ab926360b59.tar.gz scala-151d1ec5790556fcf20d60fc48be4ab926360b59.tar.bz2 scala-151d1ec5790556fcf20d60fc48be4ab926360b59.zip |
UncaughtException is now a case class (see #2017).
-rw-r--r-- | src/actors/scala/actors/ActorTask.scala | 10 | ||||
-rw-r--r-- | src/actors/scala/actors/UncaughtException.scala | 11 | ||||
-rw-r--r-- | test/files/jvm/t3356.scala | 9 |
3 files changed, 13 insertions, 17 deletions
diff --git a/src/actors/scala/actors/ActorTask.scala b/src/actors/scala/actors/ActorTask.scala index 2c48725e8e..249c3784a4 100644 --- a/src/actors/scala/actors/ActorTask.scala +++ b/src/actors/scala/actors/ActorTask.scala @@ -35,11 +35,11 @@ private[actors] class ActorTask(actor: Actor, val senderInfo = try { Some(actor.sender) } catch { case _: Exception => None } - val uncaught = new UncaughtException(actor, - if (msg != null) Some(msg) else None, - senderInfo, - currentThread, - e) + val uncaught = UncaughtException(actor, + if (msg != null) Some(msg) else None, + senderInfo, + currentThread, + e) val todo = actor.synchronized { if (!actor.links.isEmpty) diff --git a/src/actors/scala/actors/UncaughtException.scala b/src/actors/scala/actors/UncaughtException.scala index 1829d48606..2b61b1ad7a 100644 --- a/src/actors/scala/actors/UncaughtException.scala +++ b/src/actors/scala/actors/UncaughtException.scala @@ -13,17 +13,18 @@ package scala.actors * * @param actor the actor that threw the exception * @param message the message the actor was processing, or None if no message (e.g. on initial startup) + * @param sender the sender of the most recent message * @param thread the thread on which the actor was running * @param cause the uncaught exception * * @author Philipp Haller * @author Erik Engbrecht */ -class UncaughtException[Msg >: Null](val actor: Reactor[Msg], - val message: Option[Msg], - val sender: Option[OutputChannel[Any]], - val thread: Thread, - cause: Throwable) +case class UncaughtException(actor: Actor, + message: Option[Any], + sender: Option[OutputChannel[Any]], + thread: Thread, + cause: Throwable) extends Exception(cause) { override def toString() = diff --git a/test/files/jvm/t3356.scala b/test/files/jvm/t3356.scala index 8a82677b5f..5626281e7d 100644 --- a/test/files/jvm/t3356.scala +++ b/test/files/jvm/t3356.scala @@ -38,13 +38,8 @@ object Test { react { case FutureInput ! (data @ ImageData(_)) => renderImage(data) - case Exit(from, ue: UncaughtException[_]) => - ue.message match { - case Some(Download(info)) => - println("Couldn't download image "+info+" because of "+ue.getCause()) - case _ => - println("Couldn't download image because of "+ue.getCause()) - } + case Exit(from, UncaughtException(_, Some(Download(info)), _, _, cause)) => + println("Couldn't download image "+info+" because of "+cause) } } println("OK, all images rendered.") |