Using Exception Handler in an ADF Task Flow
Posted
by anmprs
on Oracle Blogs
See other posts from Oracle Blogs
or by anmprs
Published on Wed, 27 Jun 2012 11:06:10 +0000
Indexed on
2012/06/27
15:21 UTC
Read the original article
Hit count: 363
/Oracle
Problem Statement:
Exception thrown in a task flow gets wrapped in an exception that gives an unintelligible error message to the user.
Figure 1
Solution 1. Over-writing the error message with a user-friendly error message.
Figure 2
Steps to code
1. Generating an exception: Write a method that throws an exception and drop it in the task flow.
2. Adding an Exception Handler: Write a method (example below) to overwrite the Error in the bean or data control and drop the method in the task flow.
Figure 3
This method is marked as the Exception Handler by Right-Click on method > Mark Activity> Exception Handler or by the button that is displayed in this screenshot
Figure 4
The Final task flow should look like this. This will overwrite the exception with the error message in figure 2.
Note: There is no need for a control flow between the two method calls (as shown below).Figure 5
Solution 2: Re-Routing the task flow to display an error page
Figure 6
Steps to code
1. This is the same as step 1 of solution 1.
2. Adding an Exception Handler: The Exception handler is not always a method; in this case it is implemented on a task flow return. The task flow looks like this.
Figure 7
In the figure below you will notice that the task flow return points to a control flow ‘error’ in the calling task flow.
Figure 8
This control flow in turn goes to a view ‘error.jsff’ which contains the error message that one wishes to display. This can be seen in the figure below. (‘withErrorHandling’ is a call to the task flow in figure 7)
Figure 9
© Oracle Blogs or respective owner