From 52cd3ed731aedf35010f8441d6ba5d6c8504f63c Mon Sep 17 00:00:00 2001 From: Max Luebke Date: Mon, 28 Jul 2025 14:15:19 +0200 Subject: [PATCH] PhreeqcMatrix constructor: add error check after reading script --- poet/src/PhreeqcMatrix/Ctor.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/poet/src/PhreeqcMatrix/Ctor.cpp b/poet/src/PhreeqcMatrix/Ctor.cpp index dc5877a2..0c0b4ad0 100644 --- a/poet/src/PhreeqcMatrix/Ctor.cpp +++ b/poet/src/PhreeqcMatrix/Ctor.cpp @@ -18,6 +18,12 @@ PhreeqcMatrix::PhreeqcMatrix(const std::string &database, this->_m_pqc->LoadDatabaseString(database.c_str()); this->_m_pqc->RunString(input_script.c_str()); + if (this->_m_pqc->GetErrorStringLineCount() > 0) { + std::cerr << ":: Error in Phreeqc script: " + << this->_m_pqc->GetErrorString() << "\n"; + throw std::runtime_error("Phreeqc script error"); + } + this->_m_knobs = std::make_shared(this->_m_pqc.get()->GetPhreeqcPtr()); @@ -52,4 +58,4 @@ PhreeqcMatrix::PhreeqcMatrix(const std::string &database, // _m_database = other._m_database; // return *this; -// } \ No newline at end of file +// }