Integrate Software AG Products Using Digital Event Services 10.4 | Integrate Software AG Products Using Digital Event Services | MashZone NextGen Help | Appendix | Legacy Presto components | Mashables and Mashups | Mashups in EMML | Writing Mashups in EMML | Handling or Throwing Exceptions
 
Handling or Throwing Exceptions
For mashups and macros, the default behavior when an exception is thrown from an EMML statement is to stop further processing. No result is returned.
You can use two methods to change this default behavior:
Handle Exceptions For
Any EMMLStatement
<invoke> or <directinvoke>
Use the <try>/<catch> statements to catch and handle exceptions thrown from any EMML statement. These statements work very much like try-catch in other programming languages. See for a simple example.
You define how to handle an exception with EMML statements in the <catch> block. You can use almost any EMML statement in a <catch> block, including with <throw> or with <return/>.
You can use multiple <catch> blocks to catch and handle different types of exceptions based on the exception class name you specify in each <catch> block. See for more information on how exception matching is handled, examples and links to the specific exception classes that can be thrown by different EMML statements.
Also see Mashup Samples for working mashup samples you may try in Mashup Editor for exception handling.
With <invoke> or <directinvoke>, you can use lightweight error handling outside of a <try> block by adding the onerror attribute. See Lightweight Error Handling for Component Mashups and Mashables for more information.
Or, you can add onerror to <invoke> or <directinvoke> inside a <try> block to override any <catch> blocks. See for more information.
You can also use both the <throw> statement and the <return> statement anywhere in a mashup or macro. Use <throw> to create and throw a custom exception for a mashup or macro. Use <return> to forcibly stop mashup or macro processing, but still return a result.

Copyright © 2019 | Software AG, Darmstadt, Germany and/or Software AG USA, Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors.
Innovation Release