Error Handling for Component Services
If you choose to allow a mashup script to continue after a service invocation error, the EMML Reference Runtime Engine returns error information in two built-in variables:
faultcode =
-2 for timeout errors.
-1 for service invocation errors. In this case the error message is also returned.
0 for successful invocations.
faultmessage = the error message from the invocation, if this was a service 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.
To enable error recovery, you set the onerror attribute for the <directinvoke> statement. See Controlling Service Invocation at Runtime for specific information. Then use <if> to detect an error. For example:
<directinvoke endpoint="http://www.google.com/" method="get"
q="mashup" outputvariable="$result" onerror="continue"/>
<if condition="$faultcode = -1">
<constructor outputvariable="$result">
<Error>{$faultmessage}</Error>
</constructor>
<elsif condition="$faultcode = -2">
<constructor outputvariable="$result">
<Error>Service invocation timeout</Error>
</constructor>
</elsif>
<elseif condition="$faultcode = 0">
<display message="success ..." expr="$faultmessage" />
</elseif>
</if>
Enterprise Mashup Markup Language (EMML) Documentation is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.
