Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.IO/Importers/RingtoetsMacroStabilityInwardsSurfaceLineExtensions.cs =================================================================== diff -u -rf5856404ce0793d444cd6dc88ab0aef9922ad39e -r112d446cc7c77688fa3a24d3a83d1bf7e18b168a --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.IO/Importers/RingtoetsMacroStabilityInwardsSurfaceLineExtensions.cs (.../RingtoetsMacroStabilityInwardsSurfaceLineExtensions.cs) (revision f5856404ce0793d444cd6dc88ab0aef9922ad39e) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.IO/Importers/RingtoetsMacroStabilityInwardsSurfaceLineExtensions.cs (.../RingtoetsMacroStabilityInwardsSurfaceLineExtensions.cs) (revision 112d446cc7c77688fa3a24d3a83d1bf7e18b168a) @@ -45,6 +45,8 @@ /// The characteristic points to set, if the collection is valid. /// true if the characteristic points could be set; false otherwise. /// Thrown when is null. + /// Thrown when a mandatory characteristic point is not + /// present or not on the given . public static void SetCharacteristicPoints(this RingtoetsMacroStabilityInwardsSurfaceLine surfaceLine, CharacteristicPoints characteristicPoints) { if (surfaceLine == null) @@ -79,24 +81,19 @@ /// The to set the /// for. /// The point at which to set the . - /// true if the was set, false if - /// is null or there is no point in at the location - /// of . - private static bool TrySetDitchPolderSide(this RingtoetsMacroStabilityInwardsSurfaceLine surfaceLine, Point3D point) + private static void TrySetDitchPolderSide(this RingtoetsMacroStabilityInwardsSurfaceLine surfaceLine, Point3D point) { if (point != null) { try { surfaceLine.SetDitchPolderSideAt(point); - return true; } catch (ArgumentException e) { LogOptionalCharacteristicPointError(surfaceLine, e); } } - return false; } /// @@ -106,24 +103,19 @@ /// The to set the /// for. /// The point at which to set the . - /// true if the was set, false if - /// is null or there is no point in at the location - /// of . - private static bool TrySetBottomDitchPolderSide(this RingtoetsMacroStabilityInwardsSurfaceLine surfaceLine, Point3D point) + private static void TrySetBottomDitchPolderSide(this RingtoetsMacroStabilityInwardsSurfaceLine surfaceLine, Point3D point) { if (point != null) { try { surfaceLine.SetBottomDitchPolderSideAt(point); - return true; } catch (ArgumentException e) { LogOptionalCharacteristicPointError(surfaceLine, e); } } - return false; } /// @@ -133,24 +125,19 @@ /// The to set the /// for. /// The point at which to set the . - /// true if the was set, false if - /// is null or there is no point in at the location - /// of . - private static bool TrySetBottomDitchDikeSide(this RingtoetsMacroStabilityInwardsSurfaceLine surfaceLine, Point3D point) + private static void TrySetBottomDitchDikeSide(this RingtoetsMacroStabilityInwardsSurfaceLine surfaceLine, Point3D point) { if (point != null) { try { surfaceLine.SetBottomDitchDikeSideAt(point); - return true; } catch (ArgumentException e) { LogOptionalCharacteristicPointError(surfaceLine, e); } } - return false; } /// @@ -160,24 +147,19 @@ /// The to set the /// for. /// The point at which to set the . - /// true if the was set, false if - /// is null or there is no point in at the location - /// of . - private static bool TrySetDitchDikeSide(this RingtoetsMacroStabilityInwardsSurfaceLine surfaceLine, Point3D point) + private static void TrySetDitchDikeSide(this RingtoetsMacroStabilityInwardsSurfaceLine surfaceLine, Point3D point) { if (point != null) { try { surfaceLine.SetDitchDikeSideAt(point); - return true; } catch (ArgumentException e) { LogOptionalCharacteristicPointError(surfaceLine, e); } } - return false; } /// @@ -187,24 +169,22 @@ /// The to set the /// for. /// The point at which to set the . - /// true if the was set, false if - /// is null or there is no point in at the location - /// of . - private static bool TrySetSurfaceLevelInside(this RingtoetsMacroStabilityInwardsSurfaceLine surfaceLine, Point3D point) + /// Thrown when is null or + /// not on the . + private static void TrySetSurfaceLevelInside(this RingtoetsMacroStabilityInwardsSurfaceLine surfaceLine, Point3D point) { - if (point != null) + try { - try - { - surfaceLine.SetSurfaceLevelInsideAt(point); - return true; - } - catch (ArgumentException e) - { - throw CreateMandatoryCharacteristicPointException(e.Message, surfaceLine.Name); - } + surfaceLine.SetSurfaceLevelInsideAt(point); } - throw CreateMandatoryCharacteristicPointException(CreateMissingMandatoryPointMessage(RingtoetsCommonDataResources.CharacteristicPoint_SurfaceLevelInside), surfaceLine.Name); + catch (ArgumentNullException) + { + throw CreateMandatoryCharacteristicPointException(CreateMissingMandatoryPointMessage(RingtoetsCommonDataResources.CharacteristicPoint_SurfaceLevelInside), surfaceLine.Name); + } + catch (ArgumentException e) + { + throw CreateMandatoryCharacteristicPointException(e.Message, surfaceLine.Name); + } } /// @@ -214,24 +194,22 @@ /// The to set the /// for. /// The point at which to set the . - /// true if the was set, false if - /// is null or there is no point in at the location - /// of . - private static bool TrySetSurfaceLevelOutside(this RingtoetsMacroStabilityInwardsSurfaceLine surfaceLine, Point3D point) + /// Thrown when is null or + /// not on the . + private static void TrySetSurfaceLevelOutside(this RingtoetsMacroStabilityInwardsSurfaceLine surfaceLine, Point3D point) { - if (point != null) + try { - try - { - surfaceLine.SetSurfaceLevelOutsideAt(point); - return true; - } - catch (ArgumentException e) - { - throw CreateMandatoryCharacteristicPointException(e.Message, surfaceLine.Name); - } + surfaceLine.SetSurfaceLevelOutsideAt(point); } - throw CreateMandatoryCharacteristicPointException(CreateMissingMandatoryPointMessage(RingtoetsCommonDataResources.CharacteristicPoint_SurfaceLevelOutside), surfaceLine.Name); + catch (ArgumentNullException) + { + throw CreateMandatoryCharacteristicPointException(CreateMissingMandatoryPointMessage(RingtoetsCommonDataResources.CharacteristicPoint_SurfaceLevelOutside), surfaceLine.Name); + } + catch (ArgumentException e) + { + throw CreateMandatoryCharacteristicPointException(e.Message, surfaceLine.Name); + } } /// @@ -241,24 +219,22 @@ /// The to set the /// for. /// The point at which to set the . - /// true if the was set, false if - /// is null or there is no point in at the location - /// of . - private static bool TrySetDikeTopAtPolder(this RingtoetsMacroStabilityInwardsSurfaceLine surfaceLine, Point3D point) + /// Thrown when is null or + /// not on the . + private static void TrySetDikeTopAtPolder(this RingtoetsMacroStabilityInwardsSurfaceLine surfaceLine, Point3D point) { - if (point != null) + try { - try - { - surfaceLine.SetDikeTopAtPolderAt(point); - return true; - } - catch (ArgumentException e) - { - throw CreateMandatoryCharacteristicPointException(e.Message, surfaceLine.Name); - } + surfaceLine.SetDikeTopAtPolderAt(point); } - throw CreateMandatoryCharacteristicPointException(CreateMissingMandatoryPointMessage(RingtoetsCommonDataResources.CharacteristicPoint_DikeTopAtPolder), surfaceLine.Name); + catch (ArgumentNullException) + { + throw CreateMandatoryCharacteristicPointException(CreateMissingMandatoryPointMessage(RingtoetsCommonDataResources.CharacteristicPoint_DikeTopAtPolder), surfaceLine.Name); + } + catch (ArgumentException e) + { + throw CreateMandatoryCharacteristicPointException(e.Message, surfaceLine.Name); + } } /// @@ -268,24 +244,19 @@ /// The to set the /// for. /// The point at which to set the . - /// true if the was set, false if - /// is null or there is no point in at the location - /// of . - private static bool TrySetShoulderBaseInside(this RingtoetsMacroStabilityInwardsSurfaceLine surfaceLine, Point3D point) + private static void TrySetShoulderBaseInside(this RingtoetsMacroStabilityInwardsSurfaceLine surfaceLine, Point3D point) { if (point != null) { try { surfaceLine.SetShoulderBaseInsideAt(point); - return true; } catch (ArgumentException e) { LogOptionalCharacteristicPointError(surfaceLine, e); } } - return false; } /// @@ -295,24 +266,19 @@ /// The to set the /// for. /// The point at which to set the . - /// true if the was set, false if - /// is null or there is no point in at the location - /// of . - private static bool TrySetShoulderTopInside(this RingtoetsMacroStabilityInwardsSurfaceLine surfaceLine, Point3D point) + private static void TrySetShoulderTopInside(this RingtoetsMacroStabilityInwardsSurfaceLine surfaceLine, Point3D point) { if (point != null) { try { surfaceLine.SetShoulderTopInsideAt(point); - return true; } catch (ArgumentException e) { LogOptionalCharacteristicPointError(surfaceLine, e); } } - return false; } /// @@ -322,24 +288,19 @@ /// The to set the /// for. /// The point at which to set the . - /// true if the was set, false if - /// is null or there is no point in at the location - /// of . - private static bool TrySetTrafficLoadInside(this RingtoetsMacroStabilityInwardsSurfaceLine surfaceLine, Point3D point) + private static void TrySetTrafficLoadInside(this RingtoetsMacroStabilityInwardsSurfaceLine surfaceLine, Point3D point) { if (point != null) { try { surfaceLine.SetTrafficLoadInsideAt(point); - return true; } catch (ArgumentException e) { LogOptionalCharacteristicPointError(surfaceLine, e); } } - return false; } /// @@ -349,24 +310,19 @@ /// The to set the /// for. /// The point at which to set the . - /// true if the was set, false if - /// is null or there is no point in at the location - /// of . - private static bool TrySetTrafficLoadOutside(this RingtoetsMacroStabilityInwardsSurfaceLine surfaceLine, Point3D point) + private static void TrySetTrafficLoadOutside(this RingtoetsMacroStabilityInwardsSurfaceLine surfaceLine, Point3D point) { if (point != null) { try { surfaceLine.SetTrafficLoadOutsideAt(point); - return true; } catch (ArgumentException e) { LogOptionalCharacteristicPointError(surfaceLine, e); } } - return false; } /// @@ -376,24 +332,22 @@ /// The to set the /// for. /// The point at which to set the . - /// true if the was set, false if - /// is null or there is no point in at the location - /// of . - private static bool TrySetDikeToeAtRiver(this RingtoetsMacroStabilityInwardsSurfaceLine surfaceLine, Point3D point) + /// Thrown when is null or + /// not on the . + private static void TrySetDikeToeAtRiver(this RingtoetsMacroStabilityInwardsSurfaceLine surfaceLine, Point3D point) { - if (point != null) + try { - try - { - surfaceLine.SetDikeToeAtRiverAt(point); - return true; - } - catch (ArgumentException e) - { - throw CreateMandatoryCharacteristicPointException(e.Message, surfaceLine.Name); - } + surfaceLine.SetDikeToeAtRiverAt(point); } - throw CreateMandatoryCharacteristicPointException(CreateMissingMandatoryPointMessage(RingtoetsCommonDataResources.CharacteristicPoint_DikeToeAtRiver), surfaceLine.Name); + catch (ArgumentNullException) + { + throw CreateMandatoryCharacteristicPointException(CreateMissingMandatoryPointMessage(RingtoetsCommonDataResources.CharacteristicPoint_DikeToeAtRiver), surfaceLine.Name); + } + catch (ArgumentException e) + { + throw CreateMandatoryCharacteristicPointException(e.Message, surfaceLine.Name); + } } /// @@ -403,24 +357,22 @@ /// The to set the /// for. /// The point at which to set the . - /// true if the was set, false if - /// is null or there is no point in at the location - /// of . - private static bool TrySetDikeToeAtPolder(this RingtoetsMacroStabilityInwardsSurfaceLine surfaceLine, Point3D point) + /// Thrown when is null or + /// not on the . + private static void TrySetDikeToeAtPolder(this RingtoetsMacroStabilityInwardsSurfaceLine surfaceLine, Point3D point) { - if (point != null) + try { - try - { - surfaceLine.SetDikeToeAtPolderAt(point); - return true; - } - catch (ArgumentException e) - { - throw CreateMandatoryCharacteristicPointException(e.Message, surfaceLine.Name); - } + surfaceLine.SetDikeToeAtPolderAt(point); } - throw CreateMandatoryCharacteristicPointException(CreateMissingMandatoryPointMessage(RingtoetsCommonDataResources.CharacteristicPoint_DikeToeAtPolder), surfaceLine.Name); + catch (ArgumentNullException) + { + throw CreateMandatoryCharacteristicPointException(CreateMissingMandatoryPointMessage(RingtoetsCommonDataResources.CharacteristicPoint_DikeToeAtPolder), surfaceLine.Name); + } + catch (ArgumentException e) + { + throw CreateMandatoryCharacteristicPointException(e.Message, surfaceLine.Name); + } } private static void LogOptionalCharacteristicPointError(RingtoetsMacroStabilityInwardsSurfaceLine surfaceLine, ArgumentException e)