Index: Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Service/ClosingStructuresCalculationService.cs =================================================================== diff -u -rbd73023d5f8926a411da214fb5ce522056a0e30a -rce5d60b8a5c520faec45cce64de6957dce747449 --- Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Service/ClosingStructuresCalculationService.cs (.../ClosingStructuresCalculationService.cs) (revision bd73023d5f8926a411da214fb5ce522056a0e30a) +++ Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Service/ClosingStructuresCalculationService.cs (.../ClosingStructuresCalculationService.cs) (revision ce5d60b8a5c520faec45cce64de6957dce747449) @@ -85,6 +85,8 @@ CalculationServiceHelper.LogCalculationBeginTime(calculationName); + var exceptionThrown = false; + try { calculator.Calculate(input); @@ -101,14 +103,41 @@ { if (!canceled) { - log.ErrorFormat(Resources.ClosingStructuresCalculationService_Calculate_Error_in_closing_structures_0_calculation, calculationName); + var lastErrorContent = calculator.LastErrorContent; + if (string.IsNullOrEmpty(lastErrorContent)) + { + log.ErrorFormat(Resources.ClosingStructuresCalculationService_Calculate_Unexplained_error_in_closing_structures_0_calculation, + calculationName); + } + else + { + log.ErrorFormat(Resources.ClosingStructuresCalculationService_Calculate_Error_in_closing_structures_0_calculation_click_details_for_last_error_1, + calculationName, lastErrorContent); + } + + exceptionThrown = true; throw; } } finally { - log.InfoFormat(Resources.ClosingStructuresCalculationService_Calculate_Calculation_temporary_directory_can_be_found_on_location_0, calculator.OutputDirectory); - CalculationServiceHelper.LogCalculationEndTime(calculationName); + try + { + var lastErrorContent = calculator.LastErrorContent; + if (!exceptionThrown && !string.IsNullOrEmpty(lastErrorContent)) + { + log.ErrorFormat(Resources.ClosingStructuresCalculationService_Calculate_Error_in_closing_structures_0_calculation_click_details_for_last_error_1, + calculationName, lastErrorContent); + + throw new HydraRingFileParserException(lastErrorContent); + } + } + finally + { + log.InfoFormat(Resources.ClosingStructuresCalculationService_Calculate_Calculation_temporary_directory_can_be_found_on_location_0, + calculator.OutputDirectory); + CalculationServiceHelper.LogCalculationEndTime(calculationName); + } } }