SaveChangeWithChangeUnitsContext::RecordRecoverableErrorForChangeUnit Method
Indicates that a recoverable error occurred when data for this change unit was saved to the item store.
Assembly: Microsoft.Synchronization (in Microsoft.Synchronization.dll)
public: void RecordRecoverableErrorForChangeUnit( ChangeUnitChange^ changeUnitChange, RecoverableErrorData^ errorData )
Parameters
- changeUnitChange
- Type: Microsoft.Synchronization::ChangeUnitChange
The change unit change that caused the error.
- errorData
- Type: Microsoft.Synchronization::RecoverableErrorData
Additional information about the error.
| Exception | Condition |
|---|---|
| CreateFailuresMustBeForEntireItemException | The save action that is contained in the SaveChangeWithChangeUnitsContext object is Create. In this situation, creation of the entire item must fail. |
When this method is called, an ItemChangeUnitOverride object is added to the learned knowledge, and the change unit change will not be enumerated again for the duration of the synchronization session.
The following example tries to create or update a change unit in the destination replica. When an exception occurs, a recoverable error that contains the exception is recorded for the change unit, and synchronization continues.
Case SaveChangeAction.Create, SaveChangeAction.UpdateVersionAndData If True Then ' Update the item store and metadata store for the specified change unit. Try Dim cuData As String = DirectCast(context.ChangeData, String())(cuChange.ChangeUnitId.GetByteId()) _ContactStore.UpdateContactFromSync(change, cuChange, cuData) Catch ex As Exception Dim errData As New RecoverableErrorData(ex) context.RecordRecoverableErrorForChangeUnit(cuChange, errData) End Try Exit Select End If
case SaveChangeAction.Create: case SaveChangeAction.UpdateVersionAndData: { // Update the item store and metadata store for the specified change unit. try { string cuData = ((string[])context.ChangeData)[cuChange.ChangeUnitId.GetByteId()]; _ContactStore.UpdateContactFromSync(change, cuChange, cuData); } catch (Exception ex) { RecoverableErrorData errData = new RecoverableErrorData(ex); context.RecordRecoverableErrorForChangeUnit(cuChange, errData); } break; }
Show: