Siebel Object Interfaces Reference > Programming > Siebel Object Interface Events and Siebel Extension Events >

Error Handling


This section explains the Siebel COM Interfaces error handling differences.

COM Error Handling

The errCode parameter is the standard last parameter for every COM Data Server interface method. It is not available in the COM Data Control, Mobile Web Client Automation Server, Web Client Automation Server, or Java Data Bean. The following examples illustrate the difference between calling a COM Data Server interface method and calling the version of the method that is compatible with COM Data Control and Mobile Web Client Automation Server.

Error Handling Example—COMData Server only

GetBusObject (BusObjectName as string, errcode as integer) -> businessObject

Error Handling Example—COM Data Control and Mobile Web Client Automation Server

GetBusObject (BusObjectName as string) -> businessObject

Java Error Handling

The Siebel Java interfaces error-handling differences are explained in this section.

Errors in the Siebel Java Data Bean are handled by the SiebelException object. It supports the getErrorCode() and getErrorMessage() methods. The SiebelException object is defined in com.siebel.data.SiebelException. It is used as follows:

...

import com.siebel.data.SiebelException;
import com.siebel.data.SiebelDataBean;
...
SiebelDataBean mySiebelBean=null;
try

{
   mySiebelBean = new SiebelDataBean();
   mySiebelBean.login("Siebel://SOMSERVER/somsiebel/AppObjMgr/", "CCONWAY", "CCONWAY","enu");
}
catch (SiebelException e){
   // Exception handling code
   System.out.println (e.getErrorMessage ());
mySiebelBean = null; //avoid using mySiebelBean if login is unsuccessful
}

...

For additional methods on the SiebelException object, refer to the Siebel Java Data Bean JavaDoc installed with Siebel Tools. Note that the JavaDoc is installed only if the "Siebel Java Integration" option is installed. If so, then a zipped file containing the JavaDoc is in the <tools install>\CLASSES folder.

Error Message Tracking

For error message tracking in ActiveX, you can use either exceptions or methods. The following methods are available:

  • EnableExceptions
  • GetLastErrCode
  • GetLastErrText
EnableExceptions Method

EnableExceptions(enable as integer)

The EnableExceptions method allows applications to use the native COM error-handling technique. If the method is about to fail due to error, then a COM exception is generated and the method does not return. The COM host receives the control instead. However, it may display the error message (this is default for Microsoft Internet Explorer or VB), but it can be changed by scripting.

GetLastErrCode, GetLastErrText Method

After execution of a method, the GetLastErrCode can be invoked to check if any error was returned from the previous operation. The GetLastErrText method can be invoked to retrieve the text of the error message, for example:

GetLastErrCode() ' retrieves errCode As Integer

GetLastErrText() ' retrieves text As String

Siebel Object Interfaces Reference