The <SetErrorHandler/> Element

This element permits to set a Section to handle any errors that might be raised during the execution of the XML document.

Obs: the validation of the XML (attributes, text etc) happens before execution of the XML and so, if errors are found during validation they will not be processed by the Error Handler.

This is used as a last resort: an error during execution of the XML would terminate the call (hangup). So to prevent an abrupt call cut, we can catch the error and play some message before disconnecting.

Element Attributes

This element has no attributes.

Example:

In the XML below, suppose that interpolation of {{data.some_file_path}} in Play/text() results in a non-existent file.

If this happens, the processing will jump to Section fallback.

1
2
3
4
5
6
7
8
9
10
<IVR>
  <Section name="main">
    <SetErrorHandler>fallback</SetErrorHandler>
    <GetJSON var="data" url="file://myivr.json"/>
    <Play>{{data.some_file_path}}</Play>
  </Section>
  <Section name="fallback">
    <Speak voice="en-US-Standard-C">We are sorry. There was an error and your call could not be processed. Please try again later</Speak>
  </Section>
</IVR>