Mashups in EMML : Writing Mashups in EMML : Handling or Throwing Exceptions : Lightweight Error Handling for Component Mashups and Mashables
Lightweight Error Handling for Component Mashups and Mashables
When mashups or macros invoke a mashable information source or another mashup, you can handle exceptions that may be thrown from those invocations using a <try> block, just as you can for any EMML statement.
Or instead, you can use the onerror attribute in <directinvoke> or <invoke> as lightweight exception handling outside of a <try> block. See Controlling Component Mashup/Mashable Invocation at Runtime for specific information.
If you set onerror="continue" for exceptions from a component mashup or mashable that is not wrapped in a <try> block, the MashZone NextGen Server continues mashup or macro processing after an exception occurs and returns error information in two built-in variables:
*faultcode =
*-2 for timeout errors.
*-1 for invocation errors. In this case the error message is also returned.
*0 for successful invocations.
*faultmessage = the error message from the exception, if this was a mashup or mashable error.
Note:  
You may also see variables named fault or faultexception. The fault variable is reserved for future use. The faultexception variable is for internal use.
This example detects the exception with <if>, constructs the mashup result to indicate what error has occurred and then uses <return> to stop further execution:
<invoke service="$service" operation="getFeed"
outputvariable="$result" onerror="continue"/>
<if condition="$faultcode = -1">
<!-- invocation exception -->
<constructor outputvariable="$result">
<Error>{$faultmessage}</Error>
</constructor>
<return/>
<elsif condition="$faultcode = -2">
<!-- timeout -->
<constructor outputvariable="$result">
<Error>Service invocation timeout</Error>
</constructor>
<return/>
</elsif>
<elseif condition="$faultcode = 0">
<!-- success, do nothing -->
<display message="success ..." expr="$faultmessage" />
</elseif>
</if>
Copyright © 2013-2016 Software AG, Darmstadt, Germany.

Product LogoContact Support   |   Community   |   Feedback