<throw>

<throw>

The <throw> element throws an event. These can be predefined ones or application-defined events.

Attributes

NameData typeDescription

event

String

The event being thrown.

eventexpr

String

An ECMAScript expression evaluating to the name of the event being thrown.

message

String

A message string providing additional context about the event being thrown. The message is available as the value of “_message” within the scope of the catch element.

messageexpr

String

An ECMAScript expression evaluating to the message string.

Notes

Exactly one of “event” and “eventexpr” must be specified. Exactly one of “message” and “messageexpr” may be specified.

Example

<?xml version="1.0"?>
<vxml version="2.0">
  <form>
    <block>
      <throw event="myevent" message="hello, world!"/>
    </block>
    <catch event="myevent">
      <prompt>
        Caught my event with the following message:
        <break time="1s"/>
        <value expr="_message"/>
      </prompt>
    </catch>
  </form>
</vxml>

The output of the above script would be:

Computer: Caught my event with the following message: Computer: hello, world!

Child Tags

None

Parent Tags

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

Last updated