Portlet Factory, Version 6.1.2
Catching a timeout exception
Perform the following steps to catch a timeout exception.
- Create a page to be displayed if the service call or SQL transaction times out.
- On that page, include a named <span /> tag to be used for a Text builder call that displays the message from the timeout exception.
This example uses FailurePage for this page name.
- Add a variable to your model.
This example uses ErrorMessage for the variable name.
- Add a Text builder to your model.
- Locate the Text builder on the page and tag that you created.
- Set its Text input to the value of the ErrorMessage variable.
For example, ${Variables/ErrorMessage}.
- Add a Method named handleTimeout, with the following Body value:
{ HttpServletRequest request = webAppAccess.getHttpServletRequest(); Throwable ex = (Throwable)request.getAttribute("bowstreet.errorhandler.Exception"); String actionName = (String)request.getAttribute("bowstreet.errorhandler.ActionName"); String errorMessage = ex.toString() + " occurred in: " + actionName; webAppAccess.getVariables().setString("ErrorMessage", errorMessage); webAppAccess.processPage("FailurePage"); }- Add an Error Handler builder call to your model, with the following input values:
- Try Action
- Set to the invoke method for the service call or SQL statement. For example, ServiceCallTest.invoke.
- Catch Action
- Set to the model action that handles the error. In this case, handleTimeout.
Parent topic: Example: catching a timeout exception
Library | Support |