eutil:get-stack-trace()

The eutil:get-stack-trace() function returns a sequence of span elements representing the stack trace associated with the current exception. The stack trace, by identifying the expression where an error occurred and the expressions it was called from, makes it easier to debug errors in your XQuery code.

This function should only be used within a catch block in a try/catch expression. That expression should be generating human-readable diagnostic information, such as a SOAP fault. If eutil:get-stack-trace() is used outside of a try/catch expression, it returns an empty sequence.

   
Function Signature eutil:get-stack-trace() as element(stack-trace:span, xs:untyped)*
Function Summary The eutil:get-stack-trace() function returns a sequence of Span elements. Each Span element contains a uri attribute that identifies the file in which the error occurs, as well as elements for the starting and ending location of the error. In a sequence of Span elements, the first one is the innermost expression where the error occurred, while any subsequent ones locate enclosing expressions.
Parameters

none

Example This example shows an embedded stack trace:
   <stack-trace:Span uri="%28INTERNAL%29%2Fmdex_internal_dimension_search.xq">
          <stack-trace:Start line="20" column="75"/>
          <stack-trace:End line="20" column="143"/>
   </stack-trace:Span>
   <stack-trace:Span uri="%28INTERNAL%29%2Fmdex.xq">
          <stack-trace:Start line="44" column="2"/>
          <stack-trace:End line="44" column="58"/>
    </stack-trace:Span>
    <stack-trace:Span uri="">
          <stack-trace:Start line="2" column="0"/>
          <stack-trace:End line="2" column="136"/>
    </stack-trace:Span>
    <stack-trace:Span uri="%2Flocaldisk%2Fvvaradha%2Fsandbox%2FDEV%2Ftrunk%2Flinux-x86_64-release%2Finstall%2Fxquery%2Fmdex.xq">
          <stack-trace:Start line="91" column="15"/>
          <stack-trace:End line="91" column="46"/>
    </stack-trace:Span>
    <stack-trace:Span uri="%2Flocaldisk%2Fvvaradha%2Fsandbox%2FDEV%2Ftrunk%2Flinux-x86_64-release%2Finstall%2Fxquery%2Fmdex.xq">
          <stack-trace:Start line="157" column="4"/>
          <stack-trace:End line="163" column="5"/>
    </stack-trace:Span>
    <stack-trace:Span uri="%2Flocaldisk%2Fvvaradha%2Fsandbox%2FDEV%2Ftrunk%2Flinux-x86_64-release%2Finstall%2Fxquery%2Fmdex.xq">
          <stack-trace:Start line="175" column="2"/>
          <stack-trace:End line="175" column="24"/>
    </stack-trace:Span>