From cdd360fc2cc0c378a0d10bc9011fbdbc0a719445 Mon Sep 17 00:00:00 2001 From: Max Luebke Date: Mon, 28 Jul 2025 14:26:13 +0200 Subject: [PATCH] Engine: add error handling after run --- poet/src/Engine.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/poet/src/Engine.cpp b/poet/src/Engine.cpp index 8eead3b0..7c81b3c3 100644 --- a/poet/src/Engine.cpp +++ b/poet/src/Engine.cpp @@ -130,6 +130,12 @@ void PhreeqcEngine::Impl::run(double time_step) { const std::string runs_string = "RUN_CELLS\n -cells 1\n -time_step " + time_ss.str() + "\nEND\n"; this->RunString(runs_string.c_str()); + + if (this->GetErrorStringLineCount() > 0) { + std::cerr << ":: Error in Phreeqc script: " << this->GetErrorString() + << "\n"; + throw std::runtime_error("Phreeqc script error"); + } } void PhreeqcEngine::Impl::init_wrappers(const InitCell &cell) { @@ -242,4 +248,4 @@ void PhreeqcEngine::Impl::set_essential_values(const std::span &data) { data.subspan(offset, this->surfaceWrapperPtr->size())}; this->surfaceWrapperPtr->set(surf_span); } -} \ No newline at end of file +}