From 5b6e9f7c925c8f3cd09de54f9333d045d6039d28 Mon Sep 17 00:00:00 2001 From: Joakim Hove Date: Sun, 27 Sep 2020 23:25:16 +0200 Subject: [PATCH] Wrap Schedule construction in try catch --- .../eclipse/EclipseState/Schedule/Schedule.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp index ccfb19b7c..c2b2c3b26 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp @@ -25,9 +25,12 @@ #include #include +#include + #include #include #include +#include #include #include @@ -97,7 +100,8 @@ namespace { const ParseContext& parseContext, ErrorGuard& errors, [[maybe_unused]] std::shared_ptr python, - const RestartIO::RstState * rst) : + const RestartIO::RstState * rst) + try : python_handle(python), m_timeMap( deck , restart_info( rst )), m_oilvaporizationproperties( this->m_timeMap, OilVaporizationProperties(runspec.tabdims().getNumPVTTables()) ), @@ -143,6 +147,16 @@ namespace { if (DeckSection::hasSCHEDULE(deck)) iterateScheduleSection( python, deck.getInputPath(), parseContext, errors, SCHEDULESection( deck ), grid, fp); } + catch (const OpmInputError& opm_error) { + throw; + } + catch (const std::exception& std_error) { + OpmLog::error(fmt::format("An error occured while creating the reservior schedule\n", + "Internal error: {}", std_error.what())); + throw; + } + + template