Permalink
Browse files

=doc Explaining how to deal with Exceptions in TypedActor

  • Loading branch information...
1 parent e25455e commit bdff4f2e533fbf7272e2786e0b7ac131536dc5bd @dhobi committed Jan 7, 2014
Showing with 5 additions and 0 deletions.
  1. +5 −0 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 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

0 comments on commit bdff4f2

Please sign in to comment.