PhreeqcMatrix constructor: add error check after reading script

This commit is contained in:
Max Luebke 2025-07-28 14:15:19 +02:00
parent 979cc7dec0
commit 52cd3ed731

View File

@ -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<PhreeqcKnobs>(this->_m_pqc.get()->GetPhreeqcPtr());
@ -52,4 +58,4 @@ PhreeqcMatrix::PhreeqcMatrix(const std::string &database,
// _m_database = other._m_database;
// return *this;
// }
// }