<throw>

Raises a pre-defined or application-specific event.

Syntax

<throw
    event = "identifier"
    eventexpr = "CDATA"
    message = "CDATA"
    messageexpr = "CDATA"
/>

Attributes

Attribute

Data Type

Required?

Default

Description

event

identifier

no

NA

Pre-defined or application-specific event to raise. The raised event is available as the ECMAScript variable _event in the <catch> element that handles the event.

eventexpr

CDATA

no

NA

ECMAScript expression that evaluates to the event to raise.

message

CDATA

no

NA

String providing additional information about the event being raised. The message is available as the ECMAScript variable _message in the <catch> element that handles the event.

messageexpr

CDATA

no

NA

ECMAScript expression that evaluates to the message.

Details

Use an event handler to catch the event. For information, see <catch>.

Parents

<block>, <catch>, <error>, <filled>, <foreach>, <help>, <if>, <noinput>, <nomatch>

Children

None.

Example

<?xml version="1.0"?>
<vxml version="2.1" xmlns="http://www.w3.org/2001/vxml">
    <catch event="terminate">
        Caught terminate
        <goto next="#formExit"/>
    </catch>
    <help>
        <audio src="../../ProjectName/audio/help.wav" maxage="0"/>
            Help requested
        <goto next="#formEntry"/>
    </help>
    <error>
        Caught error
        <goto next="#formExit"/>
    </error>
    <var name="bCondition" expr="false"/>
    <form id="formEntry">
        <catch event="customEvent">
            Form scope custom handler
            Throwing terminate
            <throw event="terminate"/>
        </catch>
        <catch event="terminate" cond="bCondition">
            This handler will not be executed due to the condition
        </catch>
        <block>
            Throwing custom event
            <throw event="customEvent"/>
        </block>
    </form>
    <form id="formExit">
        <block>
            Goodbye
            <exit/>
        </block>
    </form>
</vxml>