Sketcher: Command constraints error handling adaptation

=======================================================

- Better handling for exceptions originating in Python addConstraint.
- Refactor to reuse code for handling of exceptions
This commit is contained in:
Abdullah Tahiri
2023-05-22 15:48:36 +02:00
committed by abdullahtahiriyo
parent 17f65d8746
commit bcedfae708
2 changed files with 84 additions and 84 deletions

View File

@@ -377,7 +377,11 @@ PyObject* SketchObjectPy::addConstraint(PyObject* args)
for (std::vector<Constraint*>::iterator it = values.begin(); it != values.end(); ++it) {
if (!this->getSketchObjectPtr()->evaluateConstraint(*it)) {
PyErr_SetString(PyExc_IndexError, "Constraint has invalid indexes");
PyErr_SetString(
PyExc_IndexError,
QT_TRANSLATE_NOOP(
"Notifications",
"The constraint has invalid index information and is malformed."));
return nullptr;
}
}