From c63586730c67f31f079d067b0ae71ea879b6cfde Mon Sep 17 00:00:00 2001 From: Daniel Hobi Date: Fri, 24 Jan 2014 16:16:35 +0100 Subject: [PATCH] =doc Explaining how to deal with Exceptions in TypedActor --- akka-docs/rst/scala/code/docs/actor/TypedActorDocSpec.scala | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/akka-docs/rst/scala/code/docs/actor/TypedActorDocSpec.scala b/akka-docs/rst/scala/code/docs/actor/TypedActorDocSpec.scala index db7197c527..80ccff4365 100644 --- a/akka-docs/rst/scala/code/docs/actor/TypedActorDocSpec.scala +++ b/akka-docs/rst/scala/code/docs/actor/TypedActorDocSpec.scala @@ -25,6 +25,9 @@ trait Squarer { def squareNowPlease(i: Int): Option[Int] //blocking send-request-reply def squareNow(i: Int): Int //blocking send-request-reply + + @throws(classOf[Exception]) //declare it or you will get an UndeclaredThrowableException + def squareTry(i: Int): Int //blocking send-request-reply with possible exception //#typed-actor-iface-methods } //#typed-actor-iface @@ -41,6 +44,8 @@ class SquarerImpl(val name: String) extends Squarer { def squareNowPlease(i: Int): Option[Int] = Some(i * i) def squareNow(i: Int): Int = i * i + + def squareTry(i: Int): Int = throw new Exception("Catch me!") //#typed-actor-impl-methods } //#typed-actor-impl