catch_allflow is automatically triggered when either of two things happens within a controller action:
say_hellostate an exception is raised, then Catch-All Level 1 will be called. If the user is return to that same flow and state and another exception is raised, Catch-All Level 2 will be called. This continues until you either run out of Catch-All states or if the Catch-All counter resets.
CatchAllsControllerand associated reply:
previous_session(the one that failed) specified a
fails_tostate. If so, we send the user there. Otherwise, we send the user back 2 states.
getactions, or actions that deal with user responses, going back 2 states usually takes us back to the original "question".
level2controller action and associated reply (and update the
FlowMap). You can go as far as you want. CatchAlls have no limit, just make sure you increment using the standardized method names of
CatchAllsControllerwith that reason so you can customize your messages and take the appropriate action.
CatchAllsControllerwe have two sets of Catch-All replies. One for when the message was unrecognized and another for when we've encountered a system error. We dynamically send the appropriate reply based on the
@reasoninstance variable that we set with the
before_actionin the controller.