Altova MapForce 2024 Enterprise Edition

An exception is a special component type that enables you to stop the mapping process and display an error when a condition returned by a filter occurs. You can add an exception when your mapping includes a filter that checks for a true/false condition (see Filters and Conditions). For example, you may want to throw an exception if the value of some mapping item is greater than some custom threshold.

 

Exceptions can also be added when you design WSDL Web services with MapForce (see Web Service Faults).

To add an exception to the mapping:

1.On the Insert menu, click Exception.

2.Click the Insert Exception ( ic-component_exception ) toolbar button.

3.Connect the throw input of the exception either to an on-true or on-false output of a filter.

4.Optionally, connect the error-text input of the exception to another component (typically, a constant) that supplies the text of the error when this exception is thrown.

 

Note:Both the on-true and on-false outputs of the filter must be connected. Specifically, one of these outputs must be connected directly to the exception (without any intermediary functions or components). The other output must be connected to the target component, either directly, or through other intermediary components.

 

When the mapping encounters an exception, you are notified about it as follows:

 

In MapForce, the Messages window displays an error, and the exception text (in this case, "Expense limit exceeded").

except-xslt2

If the mapping language is XSLT 2.0 or XQuery, an "Execution failed" error appears in the Messages window, and the respective XSLT2 or XQuery tab is opened. The error line is highlighted in the Messages window.

 

If you run the mapping with MapForce Server, the error "Exception was thrown!" is returned, followed by the custom exception text you have defined in MapForce.

exception_mfs

If you run the mapping from the generated C#, C++, or Java code, the error "USER EXCEPTION" is returned, followed by the custom exception text you have defined in MapForce.

exception_codegen

© 2018-2024 Altova GmbH