Exceptions

<< Click to Display Table of Contents >>

Navigation:  How To Use the VPE Control > VPE VCL >

Exceptions

Previous pageReturn to chapter overviewNext page

In case of error conditions, the VPE-VCL might raise exceptions. We call that "throw exceptions".

Properties and methods of the VPE-VCL which throw exceptions are marked in this reference.

Please consult the Object Pascal and VCL documentation for further details on how to handle exceptions.

In order to throw and handle exceptions, the class EVPEError is defined by the VPE-VCL:

TVPEVCL_ERR =

(

 VPEVCL_ERR_DOC_NOT_OPEN,

 VPEVCL_ERR_DOC_IS_OPEN,

 VPEVCL_ERR_GET_VALUE,

 VPEVCL_ERR_SET_VALUE,

 VPEVCL_ERR_TPL_LOAD,

 VPEVCL_ERR_NULL_HANDLE

);

 

EVPEError = class(Exception)

protected

 ErrCode: TVPEVCL_ERR;

 

public

 constructor CreateByCode(code:TVPEVCL_ERR);

 

 property ErrorCode: TVPEVCL_ERR read ErrCode;

end;

If an exception of type EVPEError is raised, you can catch it and retrieve the thrown exception code with the property EVPEError.ErrCode.

Possible values for ErrCode are:

VPEVCL_ERR_DOC_NOT_OPEN
The VPE Document is not open. You need to call OpenDoc prior to this operation.

VPEVCL_ERR_DOC_IS_OPEN
The VPE Document is open. The document needs to be closed prior to this operation.

VPEVCL_ERR_GET_VALUE
The value could not be retrieved. Possible causes: Field/Control not found, Data Type Conversion Impossible or Out of Memory.

VPEVCL_ERR_SET_VALUE
The value could not be set. Possible causes: Field/Control not found, Data Type Conversion Impossible or Out of Memory.

VPEVCL_ERR_TPL_LOAD
The template file could not be loaded. Possible causes: file not found, wrong version or VPE Edition, or Out of Memory.

VPEVCL_ERR_NULL_HANDLE
The handle to the object is invalid. It does not point to a valid VPE DLL Object. Probably the method/property that returned the object has failed.

 

After catching the Exception Code, you can check for further error information with the property VPE.LastError.