From 151d1ec5790556fcf20d60fc48be4ab926360b59 Mon Sep 17 00:00:00 2001 From: Philipp Haller Date: Thu, 29 Apr 2010 09:00:51 +0000 Subject: UncaughtException is now a case class (see #2017). --- src/actors/scala/actors/ActorTask.scala | 10 +++++----- src/actors/scala/actors/UncaughtException.scala | 11 ++++++----- 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.") -- cgit v1.2.3