Today I will talk more about best practices, not about technical problems. From what I saw, especially new ADF developers, frequently are experiencing problems with handling JboExceptions. Its not about how to throw JboException, but about how to invoke method that throws it.
Download sample application - JboExceptionPropagation.zip. This sample implements two approaches about how to call custom method from the Model layer. Custom method is simple, it just throws JboException in both cases:
Method that I'm calling from managed bean, is implemented and exposed through Application Module client interface:
It simply throws JboException:
This custom method is declared in Page Definition Bindings, to make it available for the client:
Now most important part of this blog - how we invoke custom method defined in Application Module implementation class:
First function calls custom method correctly - through bindings. In case of JboException in that custom method, framework will raise error popup automatically.
Second function is accessing Application Module Implementation class directly, bypassing bindings layer. In this case, if developer forgets to catch thrown JboException - server error will appear and application will be broken.
So, always call custom methods from Application Module interface through bindings layer.