WebSphere Commerce EnterpriseWebSphere Commerce Professional

IBM Gift Center exception handling

When an exception occurs deep in the service layer, an ECException is thrown up the stack. The GiftRegistryComponentServiceImpl catches all non-runtime exceptions and processes them. If the ECException is not an ECApplicationException, then the exception is simply converted into a ServiceException and thrown to the WebSphere Commerce calling commands to handle. If the thrown exception is an ECApplicationException, then GiftRegistryComponentServiceImpl converts this exception to a confirm BOD and returns it to the calling command.

The following diagram depicts the error handing for the IBM Gift Center:

IBM Gift Center for WebSphere Commerce exception handling

Conversion of a ECApplicationException to a ConfirmBOD is done automatically. A WebSphere Commerce action can call a helper method to inspect the confirm BOD and on error, throw another ECApplicationException. The following code excerpt illustrates this:


// Call the service and get the result 
updateResult = service.updateGiftRegistry(getUpdateGiftRegistryBOD());

// check the result 
GiftRegistryUtils.checkConfirmBODAndThrowExceptionOnError( 
        updateResult, 
        CLASS_NAME, 
        methodName);

JSP files that include ErrorMessageSetup.jspf, as described above, handle errors and display appropriate error messages.