From 41884915e39e9a359bc130f10f866aec11704772 Mon Sep 17 00:00:00 2001 From: Patrik Nordwall Date: Thu, 4 Jul 2013 15:26:29 +0200 Subject: [PATCH] Update ActorInitializationException message to be symmetric Java/Scala, see #3275 --- akka-actor/src/main/scala/akka/actor/Actor.scala | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/akka-actor/src/main/scala/akka/actor/Actor.scala b/akka-actor/src/main/scala/akka/actor/Actor.scala index f8fb593b07..86e726ecae 100644 --- a/akka-actor/src/main/scala/akka/actor/Actor.scala +++ b/akka-actor/src/main/scala/akka/actor/Actor.scala @@ -433,10 +433,8 @@ trait Actor { val contextStack = ActorCell.contextStack.get if ((contextStack.isEmpty) || (contextStack.head eq null)) throw ActorInitializationException( - "\n\tYou cannot create an instance of [" + getClass.getName + "] explicitly using the constructor (new)." + - "\n\tYou have to use one of the factory methods to create a new actor. Either use:" + - "\n\t\t'val actor = context.actorOf(Props[MyActor])' (to create a supervised child actor from within an actor), or" + - "\n\t\t'val actor = system.actorOf(Props(new MyActor(..)))' (to create a top level actor from the ActorSystem)") + s"You cannot create an instance of [${getClass.getName}] explicitly using the constructor (new). " + + "You have to use one of the 'actorOf' factory methods to create a new actor. See the documentation.") val c = contextStack.head ActorCell.contextStack.set(null :: contextStack) c