IMetabaseUpdateProgress.OnError

Syntax

OnError(Data: IMetabaseUpdateProgressData; Var Ignore: Boolean);

Parameters

Data. Information about object synchronization progress.

Ignore. The parameter that determines whether an object, for which error is generated, will be skipped.

Description

The OnError method implements an event that occurs if the error occurs during synchronization of the repository object with the object in update.

Example

Executing the example requires an update file with the Update.pefx name in the root of the C disc.

Sub UserProc;
Var
    MB: IMetabase;
    Update: IMetabaseUpdate;
    Progress: MyUpdateProgress;
Begin
    MB := MetabaseClass.Active;
    Update := Mb.CreateUpdate;
    Update.LoadFromFileNF("C:\Update.pefx");
    Progress := New MyUpdateProgress.Create;
    Update.Refresh(Progress);
    Update.SaveToFileNF("C:\Update.pefx");
End Sub UserProc;

Class MyUpdateProgress: UpdateProgress
    Sub OnProgress(Data: IMetabaseUpdateProgressData);
    Begin
        Select Case Data.Stage
            Case MetabaseUpdateProgressStage.LoadPrepare: Debug.WriteLine("Prepare to synchronize");
            Case MetabaseUpdateProgressStage.LoadApply: Debug.WriteLine("Synchronizing objects…");
            Case MetabaseUpdateProgressStage.LoadFinish: Debug.WriteLine("Synchronization complete");
        End Select;
    End Sub OnProgress;

    Sub OnError(Data: IMetabaseUpdateProgressData; Var Ignore: Boolean);
    Begin
        Debug.WriteLine("Update object synchronization error '" + Data.Node.Label + "'");
        Debug.WriteLine("Error text: " + Data.Error.Message);
        If Data.Object <> Null Then
            Debug.WriteLine("Error source: " + Data.Object.Id);
            Debug.WriteLine("Object key: " + Data.Object.Key.ToString);
        End If;
        Debug.WriteLine("Object will be skipped");
        Ignore := True;
    End Sub OnError;
End Class MyUpdateProgress;

After executing the example the objects contained in the update are synchronized with their corresponding repository objects. Synchronization status is displayed in the development environment console. If an error occurs while synchronizing any objects, the information about the error is also displayed in the development environment console. The objects with errors are skipped.

See also:

IMetabaseUpdateProgress