Altova MobileTogether Designer

The Try/Catch Exceptions action has two parts (highlighted in the screenshot below):


Try: Defines a condition or an action to try.

oA condition is defined in the XPath expression of a Throw action. (See the Sharing Geolocations tutorial for an example of using the Throw action.)

oIf an action is defined (such as the Execute REST Request action in the screenshot below) and an error is detected while executing the action, then you can choose from among the following options: (i) abort the action; (ii) ignore the error and continue; or (iii) throw an exception that is stored in the Try/Catch action's variable; this is the Throw option. (Even if you choose to continue (the second option), you can still throw an error by using the Throw action.)

oBoth the Throw action (defined for a condition) or the Throw option (defined for an action) each throw an exception that is stored in the Try/Catch action's variable.

Catch: Defines actions to execute if, and only if, an exception is thrown (see the description of the screenshot below). If no Catch action is defined, then the action that follows the Try/Catch action is processed.


Note: Exceptions can be thrown in two ways: via a Throw action (defined for a condition) and via a Throw option (defined for an action).


Note:If an exception is thrown, it is stored in the variable of the Try/Catch action, and the Catch part will be executed.


Note:If no exception is thrown in the Try part of the action (by the Throw action/option), then the Catch part is not executed.


Note:If a variable contains a nodeset and the nodeset is modified during processing, then the variable is invalidated and cannot be used subsequently. However, this does not apply if only the values of variables in a nodeset have been modified.

In the Try/Catch action shown in the screenshot above, we have done the following:


1.We have given the Try/Catch variable a name of $SomeVar (by double-clicking to the right of the $ symbol, and entering the name).

2.In the Try part of the action, we have set up the Execute REST request.

3.In the Try part of the action, we have selected the Throw option for the On Error sub-action of the Execute REST request, and entered an exception message as the option's XPath expression. As a result, if an error is detected, an exception is thrown and the exception message is stored in the $SomeVar variable.

4.In the Catch part of the action, we have defined a Message Box action to show the message that is stored in the $SomeVar variable.


Note:Besides the Throw option described above, a Throw action is also available. Instead of using the Throw option of the On Error sub-action (as described in Step 2 above), you could use the Continue option and insert a Throw action in the Continue option's On Error sub-action.


The tutorial Sharing Geolocations shows how the Try/Catch and Throw actions can be used.


MobileTogether extension functions

MobileTogether provides a range of XPath extension functions that have been specifically created for use in MobileTogether designs. Some functions can be particularly useful with specific actions. For example, mt-available-languages() returns the languages in which the solution is available and could, for example, be used with the Message Box action. If a function is especially relevant to this action, it is listed below. For a full list of extension functions and their descriptions, see the topic MobileTogether Extension Functions.


© 2018-2024 Altova GmbH