<error>

Catches an error event.

Syntax

 <error
     count="integer"
     cond="js_expression"
 >
   Executable Content
 </error>

Description

Shorthand for <catch event="error">. Catches error events of all kinds.

Attribute Description
count

Minimum number of times an error must have occurred during a form or menu invocation. Optional (default is 1).

cond

JavaScript expression that must also evaluate to true for an event to be caught. Optional (default is true).

If multiple error handlers are defined in, or inherited by, the element in which the error occurs, one handler is chosen based on event count, scope, and document order. See Chapter  3, Event Handling.

Tips:

 •  Within an event handler, the _event variable contains the name of the event currently being handled; the _message variable contains the message string that provides additional information about the event. If no message was supplied when the event was thrown, the _message variable is undefined.
 •  If a JavaScript expression contains any of the characters "<", ">", or "&", that character must be replaced with the corresponding escape sequence "&lt;", "&gt;", or "&amp;". For more information, see JavaScript Quick Reference.

Usage

Parents Children
<bevocal:listen>
<bevocal:register>
<bevocal:verify>
<field>
<form>
<initial>
<menu>
<record>
<subdialog>
<transfer>
<vxml>
<audio>
<assign>
<bevocal:connect>
<bevocal:dial>
<bevocal:disconnect>
<bevocal:foreach>
<bevocal:hold>
<bevocal:whisper>
<clear>
<data>
<disconnect>
<enumerate>
<exit>
<goto>
<if>
<log>
<prompt>
<reprompt>
<rethrow>
<return>
<script>
<send>
<subdialog>
<submit>
<throw>
<var>
<value>

See Also

 •  VoiceXML 2.0 Specification: <error>
 •  Related variables: _event, _message
 •  Related tags: <catch>, <help>, <noinput>, <nomatch>, <rethrow>, <throw>

Examples

 <?xml version="1.0" ?>
 <!DOCTYPE vxml PUBLIC "-//BeVocal Inc//VoiceXML 2.0//EN"
  "http://cafe.bevocal.com/libraries/dtd/vxml2-0-bevocal.dtd">
 
 <vxml version="2.0" xmlns="http://www.w3.org/2001/vxml">
   <form id="foo">
     <error>
       <prompt> That code is bad! <value expr="code"/></prompt>
       <disconnect/>
     </error>
     <field name="code" type="digits">
       <prompt> Say your passcode now. </prompt>
       <filled>
         <if cond="code &lt; 100"> 
           <throw event="error"/>
         <else/> 
           <prompt>Good passcode!</prompt>
         </if>
       </filled>
     </field>
     <block>
       <prompt>That was the last form item.</prompt>
       <disconnect/>
     </block>
   </form>
 </vxml>

[Show Frames]   [FIRST] [PREVIOUS] [NEXT]
BeVocal, Inc. Café Home | Developer Agreement | Privacy Policy | Site Map | Terms & Conditions
Part No. 520-0001-02 | © 1999-2007, BeVocal, Inc. All rights reserved | 1.877.33.VOCAL