Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Parsers/HydraRingDatabaseParseHelper.cs
===================================================================
diff -u -r64d60335b1deab4bafd37f78f3514660cc4afb27 -re73c8b159778b281ecb275512f42da65c0d02e9d
--- Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Parsers/HydraRingDatabaseParseHelper.cs (.../HydraRingDatabaseParseHelper.cs) (revision 64d60335b1deab4bafd37f78f3514660cc4afb27)
+++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Parsers/HydraRingDatabaseParseHelper.cs (.../HydraRingDatabaseParseHelper.cs) (revision e73c8b159778b281ecb275512f42da65c0d02e9d)
@@ -56,17 +56,33 @@
{
using (var reader = new HydraRingDatabaseReader(workingDirectory, query, sectionId))
{
- return reader.ReadLine();
+ return ReadLineFromReader(exceptionMessage, reader);
}
}
catch (SQLiteException e)
{
throw new HydraRingFileParserException(Resources.Parse_Cannot_read_result_in_output_file, e);
}
- catch (HydraRingDatabaseReaderException e)
+ }
+
+ ///
+ /// Tries to read a result from the reader and throws an exception if no row could be read.
+ ///
+ /// The message to use in the exception when reading fails.
+ /// The reader to read a row from.
+ /// A single row from the reader.
+ /// Thrown when no row could be read from the reader
+ /// .
+ private static Dictionary ReadLineFromReader(string exceptionMessage, HydraRingDatabaseReader reader)
+ {
+ Dictionary result = reader.ReadLine();
+
+ if (result != null)
{
- throw new HydraRingFileParserException(exceptionMessage, e);
+ return result;
}
+
+ throw new HydraRingFileParserException(exceptionMessage);
}
private static void ValidateParameters(string workingDirectory,