IMetabaseUpdateProgress.OnError

Syntax

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

Parameters

Data - information about synchronization progress.

Ignore - parameter that determines whether the object, for which the error was 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 drive.

Sub Main;

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 Main;

 

Class MyUpdateProgress: UpdateProgress

Sub OnProgress(Data: IMetabaseUpdateProgressData);

Begin

Select Case Data.Stage

Case MetabaseUpdateProgressStage.LoadPrepare: Debug.WriteLine("Prepare for synchronization");

Case MetabaseUpdateProgressStage.LoadApply: Debug.WriteLine("Synchronizing objects…");

Case MetabaseUpdateProgressStage.LoadFinish: Debug.WriteLine("Synchronization completed…");

End Select;

End Sub OnProgress;

 

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

Begin

Debug.WriteLine("Error of the update object synchronization'" + 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