Handling Transaction Exceptions
During execution of an ADF task flow, exceptions can occur that may require some kind of exception handling, such as when a method call activity throws an exception or when a user is not authorized to execute the activity.
To handle exceptions thrown from an activity or caused by some other type of ADF controller error, you can create an exception handler for an ADF bounded or unbounded task flow. When an exception is raised within the task flow, control flow passes to the designated exception handling activity. The exception handler activity can be any supported activity type, for example, a view that displays an error message, or a router activity that passes control flow to a method, based on an expression that evaluates the type of exception.
As a best practice, any ADF bounded task flow representing a managed transaction should designate an exception handling activity. When running an ADF bounded task flow managed transaction, the ADF controller attempts to commit the transaction when it reaches a task flow return activity identified in metadata for a commit. If the commit throws an exception, control is passed to the ADF bounded task flow’s exception handling activity. This provides the end user with a chance to correct any data and then reattempt to commit it. You can use the exception handling activity to display a warning message on a page that tells the user to correct the data and attempt to commit it again.