Index: Ringtoets/Common/src/Ringtoets.Common.Service/WaveHeightCalculationService.cs =================================================================== diff -u -r80e51fdd446be6524d4f3bcc4175e8d3ae9c86ff -re39274536935505756861bab61ab2e379162b33e --- Ringtoets/Common/src/Ringtoets.Common.Service/WaveHeightCalculationService.cs (.../WaveHeightCalculationService.cs) (revision 80e51fdd446be6524d4f3bcc4175e8d3ae9c86ff) +++ Ringtoets/Common/src/Ringtoets.Common.Service/WaveHeightCalculationService.cs (.../WaveHeightCalculationService.cs) (revision e39274536935505756861bab61ab2e379162b33e) @@ -120,19 +120,19 @@ } finally { - try + var lastErrorFileContent = calculator.LastErrorFileContent; + bool errorOccurred = ErrorOccurred(exceptionThrown, lastErrorFileContent); + if (errorOccurred) { - var lastErrorContent = calculator.LastErrorFileContent; - if (!canceled && !exceptionThrown && !string.IsNullOrEmpty(lastErrorContent)) - { - log.Error(messageProvider.GetCalculationFailedMessage(hydraulicBoundaryLocation.Name, lastErrorContent)); - throw new HydraRingFileParserException(lastErrorContent); - } + log.Error(messageProvider.GetCalculationFailedMessage(hydraulicBoundaryLocation.Name, lastErrorFileContent)); } - finally + + log.InfoFormat(Resources.WaveHeightCalculationService_Calculate_Calculation_temporary_directory_can_be_found_on_location_0, calculator.OutputDirectory); + CalculationServiceHelper.LogCalculationEndTime(calculationName); + + if (errorOccurred) { - log.InfoFormat(Resources.WaveHeightCalculationService_Calculate_Calculation_temporary_directory_can_be_found_on_location_0, calculator.OutputDirectory); - CalculationServiceHelper.LogCalculationEndTime(calculationName); + throw new HydraRingFileParserException(lastErrorFileContent); } } } @@ -149,6 +149,11 @@ } } + private bool ErrorOccurred(bool exceptionThrown, string lastErrorFileContent) + { + return !canceled && !exceptionThrown && !string.IsNullOrEmpty(lastErrorFileContent); + } + private WaveHeightCalculationInput CreateInput(HydraulicBoundaryLocation hydraulicBoundaryLocation, double norm, string hydraulicBoundaryDatabaseFilePath) { var waveHeightCalculationInput = new WaveHeightCalculationInput(1, hydraulicBoundaryLocation.Id, norm);