api:try

Version 23.0.9145


api:try


Use the api:try and api:catch keywords to create an exception-handling block in a script. If a keyword inside the api:try body throws an RSBException, the application looks for a matching api:catch keyword inside the same scope and executes the catch body.

Parameters

None

Control Attributes

None

Example

Throw and catch an exception. Inside the keyword scope, api:ecode and api:emessage attributes are added to the current item and pushed out.

<api:call op="...">
  <api:try>
    <api:throw code="myerror" description="thedescription" details="Other Details."/>
    <api:catch code="myerror">
      <api:set attr="api:ecode" value="[_code]"/>
      <api:set attr="api:emessage" value="[_description]: [_details]"/>
      <api:push/>
    </api:catch>
  </api:try>
</api:call>

See Also