Type
Event handler item
Available from
Purpose
The Catch event handler is a generic handler for events you create. Catch (VXML Events) catches VXML events that are thrown in the application or by the VXML platform.
Note:
Dialog Designer has built-in event handlers for most of the default VoiceXML
events. The Catch event handler is designed to handle all other, custom, events.
For more information about the built-in event handlers, see:
Behavior
Before you can use the Catch event handler, you must create the event for it to catch. You must also, somewhere in your application, within the scope of this event handler, use a Throw item.
The Catch event handler responds to a specified event anywhere within the scope of the handler. For example, if you place the Catch event handler in the AppRoot node, it acts as a global event handler for the specified events. It can catch these specified events no matter where in the application the events are thrown. If you place the Catch event handler in another node, however, it can catch the specified event only if it is thrown while in that node. If you place the Catch event handler underneath a node item, it can catch the specified event only if it is thrown within that node item.
A Catch event handler at the node item level overrides a Catch event handler at the node level. Likewise, a Catch event handler at the node level overrides a Catch event handler at the AppRoot, or global, level.
For more information about creating events, throwing events, and catching events, see Working with Event Types.
Examples for handling events:
- Catch (event="myEvent"), Return Event
- In this scenario, when the "myEvent" event is caught, the module will exit, returning control back to the calling application, and it will return the "myEvent" that was caught.
- In other words, it propagates or re-throws the event to let the calling application handle the event.
- Catch (event="error.runtime"), Return Event, Throw (event="myReallyBadEvent", message="Something happened...")
- In this scenario, the application catches an "error.runtime" event and the module will exit returning control back to the calling application.
- Instead of propagating the "error.runtime" event, however, it returns "myReallyBadEvent" instead, with the message "Something happened...". The calling application can catch the "myReallyBadEvent" event, but does not know that the cause of the event was an "error.runtime" event.
- Catch ("error.badfetch"), Exit
- In this case, the application catches an "error.badfetch" event and then exits the application. Exiting the application will essentially disconnect the caller and terminate the session.
- It does not matter if it is a module or a stand-alone application, the application will end. This is typically used when there is some fatal error with the application or system.
Properties
- Event - Select the event that you want the Catch event handler to handle.
- For the Catch event handler to work, you must specify the event for it to catch when the event is thrown. You must also use one or more of the following options with it:
- Prompt item - This item plays the designated prompt to the caller before the application continues.
- Goto item - This item directs the application to the designated node.
- Throw item - Throws an event that you choose. Select a user-defined event that you have created.
- By throwing an event within an event handler, you can transfer control to a different part of the application, for example, to the AppRoot node. For more information about throwing events and handling events, see Throw or Working with Event Types.