Extending : Channel policy management and extension : Channel level policy management : Exception handling
  
Exception handling
When a channel policy check rejects (PolicyResult.accept==false) a request, the UDTT Channel driver will throw the com.ibm.btt.channel.ChannelPolicyException exception. By default, the UDTT presentation handler returns the exception to the client end. But a more user friendly error message to client end might be more appropriate. In this case, a technical developer must extend the channel presentation handler to handle the exception.
For example, in the HTML channel, the default presentation handler is
com.ibm.btt.cs.html.AjaxHtmlPresentationHandler
or
com.ibm.btt.cs.html.HtmlPresentationHandler
To handle exceptions according to the requirements of specific applications, technical developers must extend either of the above presentation handlers and override the handleException method.
public void handleException(ChannelContext channelContext, Exception e)
In the method, the presentation handler handles any exception that is thrown while processing the request, and navigates a user to the proper error page with a proper message. Below is an example of the handleException method implementation to demonstrate how to handle ChannelPolicyException.
Example of the handleException method implementation
This graphic is described in the surrounding text.
To apply the new presentation handler, technical developers must configure this presentation handler in the btt.xml file for the channel.
See also
Channel level policy management