Replace extremely opaque (unhelpful) error message with a truthful reflection of what we know.

This commit is contained in:
Ralf W. Grosse-Kunstleve
2022-05-10 18:22:50 -07:00
parent de84a27fd4
commit 498195ac4b
2 changed files with 8 additions and 3 deletions

View File

@@ -228,7 +228,10 @@ TEST_SUBMODULE(exceptions, m) {
throw py::error_already_set();
} catch (const std::runtime_error &e) {
if ((err && e.what() != std::string("ValueError: foo"))
|| (!err && e.what() != std::string("Unknown internal error occurred"))) {
|| (!err
&& e.what()
!= std::string("Internal error: error_string() called without a Python "
"error available."))) {
PyErr_Clear();
throw std::runtime_error("error message mismatch");
}