Index: Ringtoets/Piping/src/Ringtoets.Piping.IO/SoilProfiles/PipingSoilProfileTransformer.cs =================================================================== diff -u -rd0d3ed3067ec66c52283bd4d1c44011b1a412492 -r25a8f2ee9f77aa01d7c9209b27075bafb9469aff --- Ringtoets/Piping/src/Ringtoets.Piping.IO/SoilProfiles/PipingSoilProfileTransformer.cs (.../PipingSoilProfileTransformer.cs) (revision d0d3ed3067ec66c52283bd4d1c44011b1a412492) +++ Ringtoets/Piping/src/Ringtoets.Piping.IO/SoilProfiles/PipingSoilProfileTransformer.cs (.../PipingSoilProfileTransformer.cs) (revision 25a8f2ee9f77aa01d7c9209b27075bafb9469aff) @@ -112,7 +112,8 @@ } catch (ArgumentException e) { - throw new ImportedDataTransformException(e.Message, e); + string message = CreateErrorMessage(soilProfile2D.Name, e.Message); + throw new ImportedDataTransformException(message, e); } } @@ -136,8 +137,14 @@ } catch (ArgumentException e) { - throw new ImportedDataTransformException(e.Message, e); + string message = CreateErrorMessage(soilProfile1D.Name, e.Message); + throw new ImportedDataTransformException(message, e); } } + + private static string CreateErrorMessage(string soilProfileName, string errorMessage) + { + return string.Format(RingtoetsCommonIOResources.Transform_Error_occurred_when_transforming_SoilProfile_0_ErrorMessage_1_, soilProfileName, errorMessage); + } } } \ No newline at end of file Index: Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/SoilProfiles/PipingSoilProfileTransformerTest.cs =================================================================== diff -u -rc71efcd328d420bd869028dd35d035ff02d98ec2 -r25a8f2ee9f77aa01d7c9209b27075bafb9469aff --- Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/SoilProfiles/PipingSoilProfileTransformerTest.cs (.../PipingSoilProfileTransformerTest.cs) (revision c71efcd328d420bd869028dd35d035ff02d98ec2) +++ Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/SoilProfiles/PipingSoilProfileTransformerTest.cs (.../PipingSoilProfileTransformerTest.cs) (revision 25a8f2ee9f77aa01d7c9209b27075bafb9469aff) @@ -183,7 +183,7 @@ { // Setup var random = new Random(21); - var profile = new SoilProfile2D(0, string.Empty, Enumerable.Empty(), Enumerable.Empty()) + var profile = new SoilProfile2D(0, "A profile name", Enumerable.Empty(), Enumerable.Empty()) { IntersectionX = random.NextDouble() }; @@ -196,7 +196,8 @@ Exception innerException = exception.InnerException; Assert.IsInstanceOf(innerException); - Assert.AreEqual(innerException.Message, exception.Message); + string expectedMessage = CreateExpectedErrorMessage(profile.Name, innerException.Message); + Assert.AreEqual(expectedMessage, exception.Message); } [Test] @@ -394,7 +395,8 @@ Exception innerException = exception.InnerException; Assert.IsInstanceOf(innerException); - Assert.AreEqual(innerException.Message, exception.Message); + string expectedMessage = CreateExpectedErrorMessage(profileName, innerException.Message); + Assert.AreEqual(expectedMessage, exception.Message); } [Test] @@ -459,6 +461,12 @@ Assert.AreEqual(bottom, transformed.Bottom); } + private static string CreateExpectedErrorMessage(string soilProfileName, string errorMessage) + { + return $"Er is een fout opgetreden bij het inlezen van ondergrondschematisatie '{soilProfileName}': " + + $"{errorMessage}"; + } + private static void AssertPipingSoilLayers(IEnumerable expectedSoilLayer2Ds, IEnumerable actualSoilLayer2Ds) {