diff --git a/akka-actor/src/main/scala/akka/actor/FSM.scala b/akka-actor/src/main/scala/akka/actor/FSM.scala index a58abb0ac3..f2faccce25 100644 --- a/akka-actor/src/main/scala/akka/actor/FSM.scala +++ b/akka-actor/src/main/scala/akka/actor/FSM.scala @@ -427,6 +427,8 @@ trait FSM[S, D] extends Listeners with ActorLogging { /** * Set handler which is called upon reception of unhandled messages. Calling * this method again will overwrite the previous contents. + * + * The current state may be queried using ``stateName``. */ final def whenUnhandled(stateFunction: StateFunction): Unit = handleEvent = stateFunction orElse handleEventDefault diff --git a/akka-docs/rst/scala/fsm.rst b/akka-docs/rst/scala/fsm.rst index b8fac5a6e3..bcccce0197 100644 --- a/akka-docs/rst/scala/fsm.rst +++ b/akka-docs/rst/scala/fsm.rst @@ -192,6 +192,9 @@ do something else in this case you can specify that with .. includecode:: code/docs/actor/FSMDocSpec.scala :include: unhandled-syntax +Within this handler the state of the FSM may be queried using the +:meth:`stateName` method. + **IMPORTANT**: This handler is not stacked, meaning that each invocation of :func:`whenUnhandled` replaces the previously installed handler.