Index: Ringtoets/Common/src/Ringtoets.Common.Data/UpdateDataStrategies/UpdateDataStrategyBase.cs =================================================================== diff -u -r9997d3038d16fb710ffc92f95c781639d63d7855 -r56ac4eb28f5fcc5b20117474e9e4030399d6806a --- Ringtoets/Common/src/Ringtoets.Common.Data/UpdateDataStrategies/UpdateDataStrategyBase.cs (.../UpdateDataStrategyBase.cs) (revision 9997d3038d16fb710ffc92f95c781639d63d7855) +++ Ringtoets/Common/src/Ringtoets.Common.Data/UpdateDataStrategies/UpdateDataStrategyBase.cs (.../UpdateDataStrategyBase.cs) (revision 56ac4eb28f5fcc5b20117474e9e4030399d6806a) @@ -24,7 +24,9 @@ using System.Linq; using Core.Common.Base; using Core.Common.Utils; +using Ringtoets.Common.Data.Exceptions; using Ringtoets.Common.Data.FailureMechanism; +using Ringtoets.Common.Data.Properties; namespace Ringtoets.Common.Data.UpdateDataStrategies { @@ -42,7 +44,7 @@ where TTargetData : class where TFailureMechanism : IFailureMechanism { - protected readonly TFailureMechanism failureMechanism; + protected readonly TFailureMechanism FailureMechanism; private readonly IEqualityComparer equalityComparer; /// @@ -63,7 +65,7 @@ } this.equalityComparer = equalityComparer; - this.failureMechanism = failureMechanism; + FailureMechanism = failureMechanism; } /// @@ -92,11 +94,7 @@ /// the . /// The source file path. /// A of affected objects. - /// Thrown when any of the input parameters are null. - /// Thrown when duplicate items are being added to the - /// . - /// Thrown when duplicate items are found during the - /// update of the items in the . + /// Thrown when an error occurred while updating the data. protected IEnumerable UpdateTargetCollectionData(ObservableUniqueItemCollectionWithSourcePath targetDataCollection, IEnumerable importedDataCollection, string sourceFilePath) @@ -114,7 +112,18 @@ throw new ArgumentNullException(nameof(sourceFilePath)); } - return ModifyDataCollection(targetDataCollection, importedDataCollection, sourceFilePath); + try + { + return ModifyDataCollection(targetDataCollection, importedDataCollection, sourceFilePath); + } + catch (ArgumentException e) + { + throw new UpdateDataException(e.Message, e); + } + catch (InvalidOperationException e) + { + throw new UpdateDataException(Resources.UpdateDataStrategyBase_UpdateTargetCollectionData_Imported_data_must_contain_unique_items, e); + } } /// @@ -169,11 +178,14 @@ } /// - /// Updates all the objects and their dependent data that needs to be updated with data from the imported data collection. + /// Updates all the objects and their dependent data that needs to be + /// updated with data from the imported data collection. /// /// The objects that need to be updated. /// The data to update from. /// A of affected items. + /// Thrown when the imported + /// contains duplicate items. private IEnumerable UpdateData(IEnumerable objectsToUpdate, IEnumerable importedDataCollection) {