Code exception handling  Handling exceptions inline

Chapter 20: Creating ActiveX Clients

Using an ActiveX error handler

By default, the ActiveX proxy raises an ActiveX exception when an EAServer component method raises an exception or an internal error occurs. Visual Basic and most other ActiveX scripting tools do not allow you to handle these errors inline. Instead, control transfers to an error handler (specified by on error goto in Visual Basic) or to a system-wide error dialog box. To handle proxy errors inline, you must enable inline exception handling as described in “Handling exceptions inline”.

Structure of an ActiveX exception

In C++, the OLE EXCEPINFO structure describes an ActiveX exception. Different ActiveX-enabled IDEs provide different mechanisms for applications to obtain the EXCEPINFO structure contents.

In Visual Basic, exceptions are mapped to the built-in Err object. The exception number maps to Err.Number and the description is available as Err.Description. You can handle exceptions by activating error handling code with On Error Goto statement or by checking whether Err.Number is > 0.

The proxy type library defines error numbers for client-side errors in the JagORBClientErrNum enumeration and server-side error numbers in the JagORBServerErrNum enumeration.

NoteIDL user-defined exceptions are not supported and are mapped to error number 9000.

Client error numbers

Table 20-1 lists the codes for client-side error numbers defined in the JagORBClientErrNum enumeration:

Table 20-1: JagORBClientErrNum error codes

Symbolic error code

Number

Description

jagClNonByteArrayErr

8000

Method arguments of type array can only have a base element type of byte.

jagClMultiDimArrayErr

8001

Multi-dimensional arrays not supported as an argument to a method.

jagClArrayRedimErr

8002

A Fatal Internal Error was encountered while attempting to resize a method argument of type array.

jagClArrayProcErr

8003

A Fatal Internal Error was encountered while processing a method argument of type array.

jagClArrayEmptyErr

8004

An array of size 0 was passed as parameter to a method.

jagClArrayBoundsErr

8005

A Fatal Internal Error was encounterd while attempting to determine the upper bound on a method argument of type array.

jagClNotJagComponentErr

8006

The component being instantiated is not a valid EAServer component or was not registered in the Windows Registry.

jagClOutOfMem

8007

The Application failed to acquire memory from the Operating System.

jagClCreateFactErr

8008

The EAServer Proxy Server could not instantiate a Factory Object. Please contact Sybase Technical Support.

jagClTypeLibErr

8009

The type library for the Component could not read from the Windows Registry. Please check if a valid directory location was specified for the Type Library while registering the component.

jagClTypeInfoErr

8010

The type information for the Component could not read from the Type Library. Please regenerate TLB and REG files for the component using EAServer Manager.

jagClMethInfoErr

8011

The metadata for the method or component could not be read from the Windows Registry or the method is using parameter types that are not presently supported in the EAServer ActiveX Proxy.

jagClMethNameErr

8012

The metadata for the method invoked on component could not be read from the Windows Registry. Please regenerate TLB and REG files for the component using EAServer Manager.

jagClCompNameErr

8013

The component name for the component being instantiated could not read from the Windows Registry.

jagClPkgNameErr

8014

The package name for the Component being instantiated could not read from the Windows Registry.

jagClPxyCreateErr

8015

Component creation failed.

jagClPxyDestroyErr

8016

Component deletion failed.

jagClPxyFuncDescErr

8017

The metadata information for the method could not read from the type library.

jagClArgCountErr

8018

There was a mismatch between the number of parameters passed to method and the number of parameters as described by the information in the type library.

jagClInternalErr

8019

An error was encountered while invoking an EAServer method.

jagClParamInfoErr

8020

The type information for a method parameter could not be read from the Type Library.

jagClTypeMismatchErr

8021

There is a mismatch between type of the value passed as an argument with its specified type in the Type Library.

jagClConversionErr

8022

The data conversion attempted is presently not supported.

jagClArgUpdateErr

8023

An error was encountered while updating an input-output or output parameter for a method.

jagClRetValSetErr

8024

An error was encountered while updating the return value for a method.

jagClRecsetArgErr

8025

The ResultSet type cannot be passed as a parameter in either the input or input-output modes by an EAServer ActiveX application.

jagClUnsuppTypeErr

8026

An unsupported OLE Automation type was used as a parameter in a method.

jagClAxConvertErr

8027

An error was encountered while converting a input-output method parameter received from the server.

jagClJagConvertErr

8028

An error was encountered while converting a input parameter prior to method invocation.

jagClNoInitErr

8029

an EAServer component instance must be created prior to invoking a method.

jagClRecordsetCreateErr

8030

An internal error was encountered while creating the Recordset object.

jagClRecordsetMoveErr

8031

Attempt to call MoveNext on a RecordSet which has its EOF property as TRUE.

jagClIteratorPosErr

8032

An invalid position was specified while attempting to retrieve an element from a collection.

jagClInvalidMethodErr

8033

The only method supported on the generic Object type is Narrow_.

jagClNarrowFailErr

8034

The object reference cannot be narrowed to the interface name specified.

jagClInvalidIntfErr

8035

The fully scoped interface name passed as an argument to the Narrow_ method is invalid.

jagClOrbInitErr

8036

An internal error was encountered while initializing client-side ORB.

jagClOrbStrToObjErr

8037

An internal error was encountered while invoking the ORB.string_to_object method.

Server error numbers

Table 20-2 lists the codes for server-side error numbers defined in the JagORBServerErrNum enumeration:

Table 20-2: JagORBServerErrNum error codes

Symbolic error code

Number

Description

jagSrvMethExcepErr

9000

The method implementation threw an user-defined exception while executing on the server.

jagSrvMethInvalidErr

9001

The method name is either invalid or is presently not defined in the component's interface.

jagSrvMethInvalidArgErr

9002

The invocation of the method on the server failed because an invalid number of parameters was passed or a parameter type mismatch occurred.

jagSrvMethNotImplErr

9003

The invocation of the method on the server failed because the component does not implement the method.

jagSrvCompPermErr

9004

The invocation of the method on the server failed because user does not have the permissions to instantiate the component.

jagSrvCompDeployErr

9005

The invocation of the method on the server failed because component implementation was not deployed on the server.

jagSrvInternalErr

9006

The invocation of the method on the server failed due a fatal internal error.

jagSrvArgCountErr

9007

The invocation of the method on the server failed because an invalid parameter type was used by the method.

jagSrvSrvConnectErr

9008

The requested operation failed since the client could not to acquire connection to the server.

jagSrvConversionErr

9009

The invocation of the method on the server failed due to a data conversion error.

jagSrvFreeMemErr

9010

The invocation of the method on the server failed while releasing memory resources.

jagSrvIntfReposErr

9011

The invocation of the method on the server failed while trying to access the interface repository.

jagSrvOutOfMemErr

9012

The invocation of the method on the server failed while trying to acquire memory from the Operating System.

jagSrvOutOfResErr

9013

The invocation of the method on the server failed since it could not acquire the necessary resources.

jagSrvSrvRespErr

9014

The invocation of the method on the server failed because there was no valid response from the server.

jagSrvInvObjrefErr

9015

The invocation of the method on the server failed because the object reference is invalid.





Copyright © 2005. Sybase Inc. All rights reserved. Handling exceptions inline

View this book as PDF