IRuntimeInterop.LastError

Syntax

LastError: IException;

Description

The LastError property returns information on the last error that occurred within the current application stream.

Comments

Handling various exceptions requires the Try...End Try operator and a number of system exception classes. These classes enable the user to handle base errors that occur during custom or system properties or methods' execution.

Specific values may occur under certain conditions (invalid parameter values, lack of access permissions, and so on) during execution of system properties or methods. These errors can be handled using the Exception base class. An instance of the last error is available in this property.

Instances of basic errors and errors generated not by the platform (for example, generated at DBMS level and thrown to the platform's level) are not saved to the LastError property.

Information on the last error is deleted after value of the LastError property is obtained. If no errors occurred, or this property has already been referred to, the property returns Null.

Example

Sub UserProc;
Var
    Ex: IException;
Begin
    Ex := RuntimeInterop.LastError;
    If Ex <> Null Then
        Ex.ReportError;
    End If;
End Sub UserProc;

After executing the example it is checked if information on the last platform's error is available. A message containing error data is displayed if this information is available.

See also:

IRuntimeInterop