Exception Handling is very must for all the application, It ensures application is running in smooth. It is in our application, then allow the user to work without any interruptions. This exception handler is going to handle all DC Binding Container Exceptions or all ADF BC Exceptions. Follow the below steps,
- Create class extends with DCErrorHandlerImpl and default constructor must contains this(true) for making this is a current one in the binding context.
- Need to override the 'reportException' method and to handle our own logic for all the ADF BC Exceptions.
- Configure the ErrorHandlerClass as our Exception Handler under the Application of databindings.cpx file.
For more details check with sample.
You can download the sample workspace from here.
[Runs with Oracle JDeveloper 11g R2 Update3 + HR Schema]
How to run this sample?
Run using the Run.jsf then press the button 'Print Employee Name' it throws actual exception of 'oracle.jbo.NoDefException: JBO-25058: Definition First_Na of type Attribute is not found in EmployeesVO' but it is handled and throw the custom exception message of 'Exception Occured, Please Contact Project Admin'. Also press 'Perform Divide Operation' and see the behaviour.