

Defining a new error handler
This section explains how to define a new error handler for a service request.
About this task
Procedure
- Create a class extending
com.ibm.commerce.telesales.ui.impl.handlers.StandardErrorHandler
.Any new custom error handling implementation must extend theStandardErrorHandler
class and invoke thesuper.handleError()
method to ensure that the base error handling implementation is always performed.public class ExtStandardErrorHandler extends StandardErrorHandler { /* * Calling super.handleError() before the custom implementation make sure * that the base code implementation is always invoked. */ public boolean handleError(TelesalesServicesException serviceException) { super.handleError(serviceException); // Get the error code of the exception long errorCode = serviceException.getErrorCode(); // Write implementation by checking the error code that you want to handle. // Inside the code block return true if the error handling is completed, false in // case you still want the default error handling to be continued for this exception. // Default error handler will show an error dialog with the exception message in the user interface. if(errorCode == <error code>) { // Provide your implementation. // return true / false } else if (errorCode == <another error code>) { // Provide your implementation. // return true / false } else { // Return false will make sure that for any exceptions other than those // are handled would be left to handle by the default implementation. For those // exceptions a dialog with an exception message would be shown in the // user interface. return false; } } }
- Define a new extension definition for IBM Sales Center
error handlers extension point.You need to specify the error handler ID and the name of the class as defined in the preceding step.
<extension point="com.ibm.commerce.telesales.core.errorHandler"> <errorHandler class="com.ext.commerce.telesales.ui.impl.handlers.ExtStandardErrorHandler" id="com.ext.commerce.telesales.extStandardErrorHandler"> </errorHandler> </extension>
The Sales Center base service requests are associated withcom.ibm.commerce.telesales.standardErrorHandler
. - Associate the newly defined error handler with a service
request.You can either use an existing service request by overriding the definition with a configurator or use a new service request.
<serviceRequest label="%extServiceRequest" requestHandlerClass="com.ext.commerce.telesales.core.impl.request.ExtLogonRequest" id="com.ext.commerce.telesales.extLogon" commServiceId="com.ibm.commerce.telesales.services.TsCommunication" errorHandler="com.ext.commerce.telesales.extStandardErrorHandler"> </serviceRequest>