api:finally
Version 23.0.8844
api:finally
Version 23.0.8844
The api:finally keyword is used to execute a section of a script after control leaves an api:call, api:try, api:render, or api:script statement. It is a convenient way to clean up the formatting of generated documents.
Parameters
None
Control Attributes
None
Examples
The api:finally block is executed when an unhandled exception occurs. This can be used to ensure that tags are closed:
<table>
<api:call op="listCustomers" out="customer">
<api:first>
<thead>
<api:enum item="customer">
<td>[_attr]</td>
</api:enum>
</thead>
</api:first>
<tr>
<api:enum item="customer">
<td>[_value]</td>
</api:enum>
</tr>
<api:finally>
</table> <!-- ensure tags are still closed -->
</api:finally>
</api:call>
See Also
- api:try: Define a scope to catch exceptions.
- api:call: Loop over items returned by an operation.
- api:render: Generate a document based on an APIScript template.
- api:script: Create a script block.