This is an old revision of the document!
The <throw> element throws an event. These can be predefined ones or application-defined events.
|event||The event being thrown.|
|eventexpr||An ECMAScript expression evaluating to the name of the event being thrown.|
|message||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||An ECMAScript expression evaluating to the message string.|
Exactly one of “event” and “eventexpr” must be specified. Exactly one of “message” and “messageexpr” may be specified.
<?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!