Engine: add error handling after run

This commit is contained in:
Max Luebke 2025-07-28 14:26:13 +02:00
parent 52cd3ed731
commit cdd360fc2c

View File

@ -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<double> &data) {
data.subspan(offset, this->surfaceWrapperPtr->size())};
this->surfaceWrapperPtr->set(surf_span);
}
}
}