VoiceXML 2.1 Development Guide Home  |  Frameset Home

  C: Exceptions & Errors   |  TOC  |  w3c Standard Error Types  

General Exceptions and Error Types

One of the most important aspects of coding a solid VoiceXML application is knowing what events could be thrown in case of error, be it a minor 'noinput' event, or a catastrophic 'badfetch' error.

Mostly, we will want to assign our catch handlers at the <vxml> level of the root doc, so that the handlers are of document or application scope. Of course, circumstances may dictate that you may want to change the behavior of a certain exception at the form level, in which case the handlers will have dialog scope.

All of the following exceptions are snagged within the VoiceXML application by using the syntax described below:

            <catch event="EVENT">
              <!-- do something here -->
            </catch>

If we simply want a 'blanket' error handler that needs little fine-grained control, we can simply assign an error tag to catch all errors that occur in the application.

            <error>
                <!-- do something here -->
            </error>


We can then utilize the '_event' shadow variable to tailor the application response to the event in question by adding a few conditional statements into the mix:

            <error>
              <if cond="_event =='error.badfetch'">
                <log expr="'*** ERROR.BADFETCH CAUGHT ***'"/>
                <submit next="MyCleanupPage.cgi" namelist="var1 var 2"/>
              <elseif cond="_event =='error.semantic' "/>
                <log expr="'*** ERROR.SEMANTIC CAUGHT ***'"/> 
                <submit next="MyCleanupPage.cgi" namelist="var1 var 2"/>
              <else/>
              </if>
            </error>



Also of note is the fact that some errors are fatal application errors, and will cause the application to immediately exit. The only option for us in handling these fatal exceptions is to do a final <submit> to a cleanup/reporting page before the application ends. Obviously, these particular exceptions are immune to the 'count' attribute for the <catch> element. These fatal errors are:




  ANNOTATIONS: EXISTING POSTS
0 posts - click the button below to add a note to this page

login

  C: Exceptions & Errors   |  TOC  |  w3c Standard Error Types  

© 2003-2008 Voxeo Corporation  |  Voxeo IVR  |  VoiceXML & CCXML IVR Developer Site