Index: Ringtoets/Common/src/Ringtoets.Common.IO/SoilProfile/StochasticSoilModelImporter.cs =================================================================== diff -u -r538ae03387505acc57bc78715c2b9e428f526281 -r4fc96d31a69029557095247c8ff890d06239b65a --- Ringtoets/Common/src/Ringtoets.Common.IO/SoilProfile/StochasticSoilModelImporter.cs (.../StochasticSoilModelImporter.cs) (revision 538ae03387505acc57bc78715c2b9e428f526281) +++ Ringtoets/Common/src/Ringtoets.Common.IO/SoilProfile/StochasticSoilModelImporter.cs (.../StochasticSoilModelImporter.cs) (revision 4fc96d31a69029557095247c8ff890d06239b65a) @@ -167,13 +167,27 @@ return GetStochasticSoilModelReadResult(stochasticSoilModelReader); } } - catch (CriticalFileReadException e) + catch (Exception e) when (e is StochasticSoilModelException + || e is CriticalFileReadException) { HandleException(e); } return new ReadResult(true); } + /// + /// Reads all stochastic soil models from the . + /// + /// The . + /// Returns a collection of read stochastic soil models. + /// Thrown when the database returned incorrect + /// values for required properties. + /// Thrown when: + /// + /// no stochastic soil profiles could be read; + /// the read failure mechanism type is not supported. + /// + /// private ReadResult GetStochasticSoilModelReadResult(StochasticSoilModelReader stochasticSoilModelReader) { int totalNumberOfSteps = stochasticSoilModelReader.StochasticSoilModelCount; @@ -186,18 +200,11 @@ { return new ReadResult(false); } - try - { - NotifyProgress(Resources.StochasticSoilModelImporter_GetStochasticSoilModelReadResult_Reading_stochastic_soil_models_from_database, - currentStep++, - totalNumberOfSteps); - soilModels.Add(stochasticSoilModelReader.ReadStochasticSoilModel()); - } - catch (StochasticSoilModelException e) - { - HandleException(e); - return new ReadResult(true); - } + + NotifyProgress(Resources.StochasticSoilModelImporter_GetStochasticSoilModelReadResult_Reading_stochastic_soil_models_from_database, + currentStep++, + totalNumberOfSteps); + soilModels.Add(stochasticSoilModelReader.ReadStochasticSoilModel()); } return new ReadResult(false) @@ -252,17 +259,10 @@ /// Validate the definition of a . /// /// The to validate. - /// false when the stochastic soil model does not contain any stochastic soil profiles - /// or when a stochastic soil profile does not have a definition for a soil profile; true - /// otherwise. + /// false when the sum of the stochastic soil profiles in the stochastic + /// soil model does add up to 100%, true otherwise. private bool ValidateStochasticSoilModel(StochasticSoilModel stochasticSoilModel) { - if (!stochasticSoilModel.StochasticSoilProfiles.Any()) - { - Log.ErrorFormat(Resources.StochasticSoilModelImporter_ValidateStochasticSoilModel_No_profiles_found_in_stochastic_soil_model_0, - stochasticSoilModel.Name); - return false; - } if (!IsSumOfAllProbabilitiesEqualToOne(stochasticSoilModel)) { Log.ErrorFormat(Resources.StochasticSoilModelImporter_ValidateStochasticSoilModel_Sum_of_probabilities_of_stochastic_soil_model_0_is_not_correct,