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

@@ -183,7 +183,7 @@ PyObject* ExtensionContainerPy::hasExtension(PyObject *args) {
if (extension.isBad() || !extension.isDerivedFrom(App::Extension::getExtensionClassTypeId())) {
std::stringstream str;
str << "No extension found of type '" << type << "'" << std::ends;
throw Py::Exception(Base::BaseExceptionFreeCADError,str.str());
throw Py::TypeError(str.str());
}
bool val = false;
@@ -212,7 +212,7 @@ PyObject* ExtensionContainerPy::addExtension(PyObject *args) {
if (extension.isBad() || !extension.isDerivedFrom(App::Extension::getExtensionClassTypeId())) {
std::stringstream str;
str << "No extension found of type '" << typeId << "'" << std::ends;
throw Py::Exception(Base::BaseExceptionFreeCADError,str.str());
throw Py::TypeError(str.str());
}
//register the extension
@@ -222,7 +222,7 @@ PyObject* ExtensionContainerPy::addExtension(PyObject *args) {
delete ext;
std::stringstream str;
str << "Extension is not a python addable version: '" << typeId << "'" << std::ends;
throw Py::Exception(Base::BaseExceptionFreeCADError,str.str());
throw Py::TypeError(str.str());
}
GetApplication().signalBeforeAddingDynamicExtension(*getExtensionContainerPtr(), typeId);