Skip to content

Loading…

=doc Explaining how to deal with Exceptions in TypedActor #1967

Merged
merged 1 commit into from

3 participants

@dhobi

Here we go again ;-)

@bantonsson
Akka Project member

LGTM

@patriknw
Akka Project member

LGTM

@patriknw patriknw merged commit 5650998 into akka:master

1 check passed

Details default pr-validator-per-commit Took 67 min.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 24, 2014
  1. @dhobi
Showing with 5 additions and 0 deletions.
  1. +5 −0 akka-docs/rst/scala/code/docs/actor/TypedActorDocSpec.scala
View
5 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
Something went wrong with that request. Please try again.