Index: Ringtoets/Piping/src/Ringtoets.Piping.IO/SoilProfile/StochasticSoilModelReader.cs =================================================================== diff -u -rdc338e85283e37af4984f737a9f7ae0d213596be -rcdc41931db8cd6fbebe910c08d315d1b7066a6d2 --- Ringtoets/Piping/src/Ringtoets.Piping.IO/SoilProfile/StochasticSoilModelReader.cs (.../StochasticSoilModelReader.cs) (revision dc338e85283e37af4984f737a9f7ae0d213596be) +++ Ringtoets/Piping/src/Ringtoets.Piping.IO/SoilProfile/StochasticSoilModelReader.cs (.../StochasticSoilModelReader.cs) (revision cdc41931db8cd6fbebe910c08d315d1b7066a6d2) @@ -28,7 +28,6 @@ using Core.Common.Utils.Builders; using Ringtoets.Piping.Data; using Ringtoets.Piping.IO.Builders; -using Ringtoets.Piping.IO.Exceptions; using Ringtoets.Piping.IO.Properties; namespace Ringtoets.Piping.IO.SoilProfile @@ -65,6 +64,12 @@ /// public bool HasNext { get; private set; } + /// + /// Reads the information for the next stochastic soil model from the database and creates a + /// instance of the information. + /// + /// The next from the database, or null if no more soil models can be read. + /// Thrown when the database returned incorrect values for required properties. public StochasticSoilModel ReadStochasticSoilModel() { try @@ -76,7 +81,7 @@ if (exception is FormatException || exception is OverflowException || exception is InvalidCastException) { var message = new FileReaderErrorMessageBuilder(Path).Build(Resources.StochasticSoilProfileDatabaseReader_StochasticSoilProfile_has_invalid_value); - throw new StochasticSoilProfileReadException(message, exception); + throw new CriticalFileReadException(message, exception); } throw; } @@ -93,6 +98,10 @@ private StochasticSoilModel ReadPipingStochasticSoilModel() { + if (!HasNext) + { + return null; + } var stochasticSoilModelSegment = ReadStochasticSoilModelSegment(); var currentSegmentSoilModelId = stochasticSoilModelSegment.SegmentSoilModelId; do