Index: Ringtoets/Revetment/src/Ringtoets.Revetment.Data/WaveConditionsInputStepSizeExtensions.cs =================================================================== diff -u -r5ca67bdbaab0f6a9fb7682c06140b93bb0f5b5bb -rca0345432ea951a80e3e956a8d485840c0897e1d --- Ringtoets/Revetment/src/Ringtoets.Revetment.Data/WaveConditionsInputStepSizeExtensions.cs (.../WaveConditionsInputStepSizeExtensions.cs) (revision 5ca67bdbaab0f6a9fb7682c06140b93bb0f5b5bb) +++ Ringtoets/Revetment/src/Ringtoets.Revetment.Data/WaveConditionsInputStepSizeExtensions.cs (.../WaveConditionsInputStepSizeExtensions.cs) (revision ca0345432ea951a80e3e956a8d485840c0897e1d) @@ -19,6 +19,7 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. +using System; using System.ComponentModel; namespace Ringtoets.Revetment.Data @@ -33,9 +34,17 @@ /// /// The step size to get a real value for. /// The real value of . - /// Thrown when when using an invalid stepsize. + /// Thrown when + /// is not a valid enum value of . + /// Thrown when + /// is not supported for the conversion. public static double AsValue(this WaveConditionsInputStepSize stepSize) { + if (!Enum.IsDefined(typeof(WaveConditionsInputStepSize), stepSize)) + { + throw new InvalidEnumArgumentException(nameof(stepSize), (int)stepSize, typeof(WaveConditionsInputStepSize)); + } + switch (stepSize) { case WaveConditionsInputStepSize.Half: @@ -45,7 +54,7 @@ case WaveConditionsInputStepSize.Two: return 2.0; default: - throw new InvalidEnumArgumentException(nameof(stepSize), (int) stepSize, typeof(WaveConditionsInputStepSize)); + throw new NotSupportedException($"The enum value {nameof(WaveConditionsInputStepSize)}.{stepSize} is not supported."); } } }