From 09ca2901527deae9470174ab2de5bb12773cbf5b Mon Sep 17 00:00:00 2001 From: Dmitri Naumov <github@naumov.de> Date: Thu, 31 Aug 2023 23:38:40 +0200 Subject: [PATCH] [AppL] isConvertible should not throw but return Returning false when conversion would fail instead of OGS_FATAL. The OGS_FATAL happens on the caller side. --- Applications/ApplicationsLib/TestDefinition.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Applications/ApplicationsLib/TestDefinition.cpp b/Applications/ApplicationsLib/TestDefinition.cpp index 7c6c3b014e6..ed09d59d6d9 100644 --- a/Applications/ApplicationsLib/TestDefinition.cpp +++ b/Applications/ApplicationsLib/TestDefinition.cpp @@ -39,19 +39,21 @@ bool isConvertibleToDouble(std::string const& s) } catch (...) { - OGS_FATAL("The given string '{:s}' is not convertible to double.", s); + ERR("The given string '{:s}' is not convertible to double.", s); + return false; } if (pos != s.size()) { - OGS_FATAL( - "Only {:d} characters were used for double conversion of string " + ERR("Only {:d} characters were used for double conversion of string " "'{:s}'", pos, s); + return false; } if (std::isnan(value)) { - OGS_FATAL("The given string '{:s}' results in a NaN value.", s); + ERR("The given string '{:s}' results in a NaN value.", s); + return false; } return true; } -- GitLab