OnError(Data: IMetabaseUpdateProgressData; Var Ignore: Boolean);
Data - the information about synchronization progress.
Ignore - a parameter that determines whether the object for which the error was generated, will be skipped.
The OnError method implements an event that takes place if the error occurs during synchronization of the repository object with the object in updating.
Executing the example requires an update file with the Update.pefx name in the root of disk C.
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("Preparing for synchronization");
Case MetabaseUpdateProgressStage.LoadApply: Debug.WriteLine("Objects synchronizing...");
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: