Fixing ticket 808

This commit is contained in:
Viktor Klang 2011-04-29 17:15:00 +02:00
parent b5873ff2c7
commit c2486cd52c
14 changed files with 95 additions and 79 deletions

View file

@ -72,12 +72,14 @@ object TestActorRef {
def apply[T <: Actor : Manifest] : TestActorRef[T] = new TestActorRef[T] ({ () =>
import ReflectiveAccess.{ createInstance, noParams, noArgs }
createInstance[T](manifest[T].erasure, noParams, noArgs).getOrElse(
throw new ActorInitializationException(
createInstance[T](manifest[T].erasure, noParams, noArgs) match {
case r: Right[_, T] => r.b
case l: Left[Exception, _] => throw new ActorInitializationException(
"Could not instantiate Actor" +
"\nMake sure Actor is NOT defined inside a class/trait," +
"\nif so put it outside the class/trait, f.e. in a companion object," +
"\nOR try to change: 'actorOf[MyActor]' to 'actorOf(new MyActor)'."))
"\nOR try to change: 'actorOf[MyActor]' to 'actorOf(new MyActor)'.", l.a)
}
})
}