Siebel Object Interfaces Reference > Interfaces Reference > Application Methods >

EnableExceptions Method


The EnableExceptions method enables or disables native COM error handling.

Syntax

Application.EnableExceptions(bEnable)

Argument
Description

bEnable

A Boolean: TRUE or FALSE

Returns

Not applicable

Usage

Setting the argument to TRUE enables native error handling. This allows applications to intercept and display the exception ID and description. Native COM error handling is disabled by default.

Used With

COM Data Control, Mobile Web Client Automation Server

Examples

This native Visual Basic script uses the Siebel ActiveX Data Control to connect to the Siebel Application and instantiate a business object. The script prompts the user to select whether the native error handling is to be enabled or not. If yes, the script throws the error immediately when it gets an error. If not, the script suppresses Siebel errors and errors are only detected by using GetLastErrCode method.

Dim SiebelApplication As SiebelDataControl
Dim errCode As Integer
Dim wrongBO As SiebelBusObject

Dim nativeHandle As String

Set SiebelApplication = CreateObject("SiebelDataControl.SiebelDataControl.1")

' Login to Siebel

SiebelApplication_first.Login "host=""Siebel.tcpip.none.none://<virtual ip>:<port>/<enterprise>/<object manager>""", "<user id>", "<password>"

nativeHandle = InputBox("Use native error handling?", "", "Yes")

If nativeHandle = "Yes" Then
   SiebelApplication.EnableExceptions (True)
Else
   SiebelApplication.EnableExceptions (False)
End If

Set wrongBO = SiebelApplication.GetBusObject("No Such One") 'intended to create an error at this line by instantiating a non-existing Business Object

errCode = SiebelApplication.GetLastErrCode()
If errCode <> 0 Then 'if native error handle is disabled, this block detects it
   ErrText = SiebelApplication.GetLastErrText
   MsgBox ErrText
   Exit Sub
End If

This Visual Basic sample code uses the Siebel Mobile Automation Server to connect to the Siebel Application and instantiate a business object. The program prompts the user to select whether the native error handling is to be enabled or not. If yes, the script throws the error immediately when it gets an error. If not, the script suppresses Siebel errors and errors are only detected by using GetLastErrCode method.

Dim SiebelApp As SiebelWebApplication
Dim errCode As Integer
Dim wrongBO As SiebelBusObject

Set SiebelApp = CreateObject("TWSiebel.SiebelWebApplication.1")

Dim nativeHandle As String
nativeHandle = InputBox("Use native error handle?", "", "Yes")

If nativeHandle = "Yes" Then
   SiebelApp.EnableExceptions (True)
Else
   SiebelApp.EnableExceptions (False)
End If

Set wrongBO = SiebelApp.GetBusObject("No Such One") 'intended to create an error at this line by instantiating a non-existing Business Object

errCode = SiebelApp.GetLastErrCode()
If errCode <> 0 Then 'if native error handle is disabled, this block detects it
   ErrText = SiebelApp.GetLastErrText
   MsgBox ErrText
   Exit Sub
End If

Siebel Object Interfaces Reference Copyright © 2008, Oracle. All rights reserved.