Portlet Factory, Version 6.1.2


 

Advanced error handling techniques

If the method calls within the Java-based method have an error handler, the lower-level handler, which is the handler in the method calls that are contained in the Java-based method, is called.

To pass the handler to a higher-level, the handler must re-throw the exception.

The action called to handle the error has access to the original exception through an attribute on the request object. This allows access to the exception information from a method or a JSP page. For example, in a method that was specified to handle an error, you can find the exception by using the following code:

HttpServletRequest request = webAppAccess.getHttpServletRequest(); Throwable ex = (Throwable)request.getAttribute("bowstreet.errorhandler.Exception"); String actionName = (String)request.getAttribute("bowstreet.errorhandler.ActionName");

When adding the Error Handler builder to a specified action, associate the error handler with the action at which you want processing to stop upon failure.

For example, assume you added to a model an Action List builder (main) containing two actions, with the first one a method(MyMethod) and the second action a page(MyPage). If you type MyMethod in the Try Action field and an exception occurs in that action, the error handler is called. If your error handler does a normal return, MyPage page is still called, instead of stopping the processing.

To stop the processing when the exception is called, type Main in the Try Action field. This technique places the handler on the main Action List builder call, containing MyMethod and MyPage. This technique stops the processing of the action on an exception.

 

Handling data entry validation errors

A data entry page is a page which is managed by the Data Page builder. On a data entry page, any of the fields can be set to data entry. There are a variety of techniques you can use to deal with errors a user makes when entering data in such a page. These techniques are beyond the scope of the Error Handler builder.

Parent topic: Developing Web applications Parent topic: Linked Java Object builder Parent topic: About error handling in web applications


Library | Support |