Switching to checking InstantiationException for both create and recreate

This commit is contained in:
Viktor Klang 2012-05-22 12:14:33 +02:00
parent 0eae9d8d22
commit 916c2d4d11
2 changed files with 7 additions and 5 deletions

View file

@ -118,7 +118,7 @@ class ActorKilledException private[akka] (message: String, cause: Throwable)
* An InvalidActorNameException is thrown when you try to convert something, usually a String, to an Actor name
* which doesn't validate.
*/
case class InvalidActorNameException(message: String) extends AkkaException(message)
class InvalidActorNameException(message: String) extends AkkaException(message)
/**
* An ActorInitializationException is thrown when the the initialization logic for an Actor fails.

View file

@ -498,7 +498,7 @@ private[akka] class ActorCell(
import ActorCell.behaviorStackPlaceHolder
behaviorStack = behaviorStackPlaceHolder
val instance = props.creator()
val instance = props.creator.apply()
if (instance eq null)
throw new ActorInitializationException(self, "Actor instance passed to actorOf can't be 'null'")
@ -532,8 +532,7 @@ private[akka] class ActorCell(
a non-static inner class (in which case make it a static inner class or use Props(new ...) or Props( new UntypedActorFactory ... )
or is missing an appropriate, reachable no-args constructor.
""", i.getCause)
case NonFatal(e)
throw new ActorInitializationException(self, "exception during creation", e)
case NonFatal(e) throw new ActorInitializationException(self, "exception during creation", e)
}
}
@ -557,7 +556,10 @@ private[akka] class ActorCell(
doRecreate(cause, failedActor)
}
} catch {
case NonFatal(e) throw new ActorInitializationException(self, "exception during creation", e)
case NonFatal(e) throw new ActorInitializationException(self, "exception during creation", e match {
case i: InstantiationException => i.getCause
case other => other
})
}
}