Handles errors thrown by the platform or throw element.
cond = "ECMAScript_Expression"
count = "integer"/>
- A condition that must evaluate to true for this element to be selected by the form interpretation algorithm.
- Used by the VoiceXML interpreter in the event handler selection process, allowing the developer to handle multiple occurrences of the error event in a unique manner. The default value is 1.
|field, form, initial, menu, object, record, subdialog, transfer, vxml|
|assign, audio, break, clear, data, disconnect, enumerate, exit, foreach, goto, if, log, mark, prompt, reprompt, return, script, submit, throw, value, var|
|The error event is shorthand for a catch element with its event attribute set to "error."|
|The error event handler catches error events thrown by the Platform or by the throw element.|
|To catch a user-defined event using the error element, prefix the name of the user-defined event with "error," for example, "error.myevent."|
The following example references a non-existent external grammar file. The error event catches the error, plays a message to the user, and disconnects.
<?xml version="1.0"?> <vxml version="2.1" xmlns="http://www.w3.org/2001/vxml"> <!-- this error handler will catch any error event in this document --> <error> A fatal error occurred. Please contact a customer service representative. <disconnect/> </error> <form> <field name="get_fruit"> <prompt> Pick a fruit </prompt> <!-- The URI is invalid. The platform will throw error.badfetch. --> <grammar mode="voice" type="application/srgs+xml" src="http://badserver/badvroot/badfile.grammar" /> </field> </form> </vxml>