A thrown fault may reach a <catchall>, as in the previous example, or it may have a specific <catch>.
-
The first <trace> element generates the message before scope.
-
The <scope> element starts the scope.
-
The second <trace> element generates the message before throw.
-
The <throw> element throws a specific, named fault ("MyFault").
-
Control now goes to the <faulthandlers> defined within the <scope>. The <scope> rectangle includes a horizontal dashed line across the middle; the area below this dashed line displays the contents of the <faulthandlers> element. In this case, a <catch> element exists whose fault value is "MyFault", so control goes there. The <catchall> element is ignored.
Note that InterSystems IRIS skips the <trace> element message after the <throw> element.
If we drill down into <catch>, we see this:
Note:
If a <catchall> is provided, it must be the last statement in the <faulthandlers> block. All <catch> blocks must appear before <catchall>.
-
Within <catch>, the <trace> element generates the message in catch faulthandler for ‘MyFault’.
-
The <scope> ends.
-
The last <trace> element generates the message after scope.