diff --git a/akka-actor-tests/src/test/scala/akka/pattern/AskSpec.scala b/akka-actor-tests/src/test/scala/akka/pattern/AskSpec.scala index 1d8b880f09..ad73024623 100644 --- a/akka-actor-tests/src/test/scala/akka/pattern/AskSpec.scala +++ b/akka-actor-tests/src/test/scala/akka/pattern/AskSpec.scala @@ -76,6 +76,14 @@ class AskSpec extends AkkaSpec { }.getMessage.contains("/user/silent") should be(true) } + "include timeout information in AskTimeout" in { + implicit val timeout = Timeout(0.5 seconds) + val f = system.actorOf(Props.empty) ? "noreply" + intercept[AskTimeoutException] { + Await.result(f, remaining) + }.getMessage should include(timeout.duration.toMillis.toString) + } + "work for ActorSelection" in { implicit val timeout = Timeout(5 seconds) import system.dispatcher diff --git a/akka-actor/src/main/scala/akka/pattern/AskSupport.scala b/akka-actor/src/main/scala/akka/pattern/AskSupport.scala index afebca95c7..8eb63c3785 100644 --- a/akka-actor/src/main/scala/akka/pattern/AskSupport.scala +++ b/akka-actor/src/main/scala/akka/pattern/AskSupport.scala @@ -330,7 +330,7 @@ private[akka] object PromiseActorRef { val a = new PromiseActorRef(provider, result) implicit val ec = a.internalCallingThreadExecutionContext val f = scheduler.scheduleOnce(timeout.duration) { - result tryComplete Failure(new AskTimeoutException(s"Ask timed out on [$targetName]")) + result tryComplete Failure(new AskTimeoutException(s"Ask timed out on [$targetName] after [${timeout.duration.toMillis} ms]")) } result.future onComplete { _ ⇒ try a.stop() finally f.cancel() } a