Py: replace BaseExceptionFreeCADError with more suitable exception types

This commit is contained in:
wmayer
2022-03-17 13:54:23 +01:00
parent d84fd8a2df
commit d69defaa3c
38 changed files with 148 additions and 133 deletions

View File

@@ -234,7 +234,7 @@ PyObject* DocumentPy::addObject(PyObject *args, PyObject *kwd)
if (!pcFtr) {
std::stringstream str;
str << "No document object found of type '" << sType << "'" << std::ends;
throw Py::Exception(Base::BaseExceptionFreeCADError,str.str());
throw Py::TypeError(str.str());
}
// Allows to hide the handling with Proxy in client python code
if (obj) {
@@ -300,7 +300,7 @@ PyObject* DocumentPy::removeObject(PyObject *args)
else {
std::stringstream str;
str << "No document object found with name '" << sName << "'" << std::ends;
throw Py::Exception(Base::BaseExceptionFreeCADError,str.str());
throw Py::ValueError(str.str());
}
}
@@ -399,7 +399,7 @@ PyObject* DocumentPy::moveObject(PyObject *args)
}
else {
std::string str("Failed to move the object");
throw Py::Exception(Base::BaseExceptionFreeCADError,str);
throw Py::ValueError(str);
}
}