<error>
Catches events generated when a syntax error is thrown by the interpreter, and specifies code to be executed when this occurs. The <error> element provides shorthand notation for <catch event="error">. See <catch>, <help>, <noinput>, and <nomatch> for descriptions of similar event-catching elements.
The following three JavaScript variables are accessible within the <error> element:
- _event—Specifies the name of the event that was caught.
- _exception (Nuance extension)—Specifies the exception that caused the event to be generated.
- _message—Specifies a message that describes the event that was caught.
Attributes
This section describes the attributes you can set for this element.
Name |
Data type |
Default |
---|---|---|
CDATA |
optional |
|
CDATA |
optional |
cond
The cond attribute specifies an ECMA expression that must evaluate to Boolean true in order for code within the <error> element to be executed.
count
The count attribute (default is 1) specifies the minimum number of specified event occurrences that must take place before the code within the <error> element is executed. If two or more handlers meet this criterion, the handler selected is the one with the highest count value.
Each <clear>, <form> and <menu> element, as well as each form item maintains a counter for each event that occurs while it is being visited. These counters are reset each time the <menu> element or form item's <form> element is re-entered. The form-level counters are used in the selection of an event handler for events thrown in a form-level <filled> element.
Note: Counters are incremented against the full event name and every prefix matching event name. For example, occurrence of the event "event.foo.1" increments the counters associated with handlers for "event.foo.1", "event.foo", and "event".
Children
- Parsed character data
- <assign>
- <audio>
- <clear>
- <data>
- <disconnect>
- <enumerate>
- <exit>
- <foreach>
- <goto>
- <if>
- <log>
- <prompt>
- <reprompt>
- <return>
- <script>
- <nuance:send>
- <submit>
- <nuance:taskbegin>
- <nuance:taskend>
- <throw>
- <value>
- <var>
Parents
Sample code
<form id="monty_python_holy_grail">
<field name="your_name">
<prompt>What is your name?</prompt>
<help>
<prompt>hint: you are the king.</prompt>
<reprompt/>
</help>
</field>
<field name="swallow">
<prompt>What is the average wind speed velocity of an unladen
swallow?</prompt>
<catch event="help">
<prompt>hint: it depends where the bird comes from.</prompt>
<reprompt/>
</catch>
</field>
<noinput>
<prompt>sorry, i didn't catch that.</prompt>
<reprompt/>
</noinput>
<nomatch>
<prompt>no, sorry, that's not it. try again.</prompt>
</nomatch>
<error>
<log expr="'Error processing bridge sequence. and now for something completely different.../>
<throw event="SOMETHING_COMPLETELY_DIFFERENT"/>
</error>
<filled>You may pass.</filled>
</form>