From e4d1ed83665285cb0f072d0ca7547df2114f03a8 Mon Sep 17 00:00:00 2001 From: wmayer Date: Thu, 17 Mar 2022 14:45:48 +0100 Subject: [PATCH] Base: rename BaseExceptionFreeCADError to PyExc_FC_GeneralError --- src/App/Application.cpp | 18 ++++++------ src/App/ApplicationPy.cpp | 4 +-- src/App/GroupExtensionPyImp.cpp | 16 +++++------ src/App/MetadataPyImp.cpp | 4 +-- src/Base/BoundBoxPyImp.cpp | 2 +- src/Base/Console.cpp | 4 +-- src/Base/Exception.cpp | 4 +-- src/Base/MatrixPyImp.cpp | 4 +-- src/Base/PyObjectBase.cpp | 2 +- src/Base/PyObjectBase.h | 22 +++++++-------- src/Base/RotationPyImp.cpp | 2 +- src/Base/VectorPyImp.cpp | 2 +- src/Gui/ApplicationPy.cpp | 10 +++---- src/Gui/CommandPyImp.cpp | 14 +++++----- src/Gui/DocumentPyImp.cpp | 2 +- src/Gui/Selection.cpp | 10 +++---- src/Main/FreeCADGuiPy.cpp | 4 +-- src/Mod/Fem/App/FemMeshPyImp.cpp | 28 +++++++++---------- src/Mod/Fem/Gui/AppFemGuiPy.cpp | 2 +- src/Mod/Import/App/AppImportPy.cpp | 4 +-- src/Mod/Import/Gui/AppImportGuiPy.cpp | 6 ++-- src/Mod/Mesh/App/MeshPyImp.cpp | 2 +- src/Mod/MeshPart/App/AppMeshPartPy.cpp | 2 +- src/Mod/Part/App/AppPart.cpp | 4 +-- src/Mod/Part/App/AttachEnginePyImp.cpp | 4 +-- src/Mod/Part/App/TopoShapePyImp.cpp | 8 +++--- src/Mod/Path/App/AppPathPy.cpp | 6 ++-- src/Mod/Path/App/FeaturePathCompoundPyImp.cpp | 10 +++---- .../templateClassPyExport.py | 28 +++++++++---------- 29 files changed, 114 insertions(+), 114 deletions(-) diff --git a/src/App/Application.cpp b/src/App/Application.cpp index 1677b64ba7..4b46f93caf 100644 --- a/src/App/Application.cpp +++ b/src/App/Application.cpp @@ -165,7 +165,7 @@ Base::ConsoleObserverFile *Application::_pConsoleObserverFile = nullptr; AppExport std::map Application::mConfig; // Custom Python exception types -BaseExport extern PyObject* Base::BaseExceptionFreeCADError; +BaseExport extern PyObject* Base::PyExc_FC_GeneralError; BaseExport extern PyObject* Base::PyExc_FC_FreeCADAbort; BaseExport extern PyObject* Base::PyExc_FC_XMLBaseException; BaseExport extern PyObject* Base::PyExc_FC_XMLParseException; @@ -361,9 +361,9 @@ void Application::setupPythonException(PyObject* module) { // Define cusom Python exception types // - Base::BaseExceptionFreeCADError = PyErr_NewException("Base.FreeCADError", PyExc_RuntimeError, nullptr); - Py_INCREF(Base::BaseExceptionFreeCADError); - PyModule_AddObject(module, "FreeCADError", Base::BaseExceptionFreeCADError); + Base::PyExc_FC_GeneralError = PyErr_NewException("Base.FreeCADError", PyExc_RuntimeError, nullptr); + Py_INCREF(Base::PyExc_FC_GeneralError); + PyModule_AddObject(module, "FreeCADError", Base::PyExc_FC_GeneralError); Base::PyExc_FC_FreeCADAbort = PyErr_NewException("Base.FreeCADAbort", PyExc_BaseException, nullptr); Py_INCREF(Base::PyExc_FC_FreeCADAbort); @@ -385,23 +385,23 @@ void Application::setupPythonException(PyObject* module) Py_INCREF(Base::PyExc_FC_UnknownProgramOption); PyModule_AddObject(module, "UnknownProgramOption", Base::PyExc_FC_UnknownProgramOption); - Base::PyExc_FC_BadFormatError = PyErr_NewException("Base.BadFormatError", PyExc_Exception, nullptr); + Base::PyExc_FC_BadFormatError = PyErr_NewException("Base.BadFormatError", Base::PyExc_FC_GeneralError, nullptr); Py_INCREF(Base::PyExc_FC_BadFormatError); PyModule_AddObject(module, "BadFormatError", Base::PyExc_FC_BadFormatError); - Base::PyExc_FC_BadGraphError = PyErr_NewException("Base.BadGraphError", PyExc_Exception, nullptr); + Base::PyExc_FC_BadGraphError = PyErr_NewException("Base.BadGraphError", Base::PyExc_FC_GeneralError, nullptr); Py_INCREF(Base::PyExc_FC_BadGraphError); PyModule_AddObject(module, "BadGraphError", Base::PyExc_FC_BadGraphError); - Base::PyExc_FC_ExpressionError = PyErr_NewException("Base.ExpressionError", PyExc_Exception, nullptr); + Base::PyExc_FC_ExpressionError = PyErr_NewException("Base.ExpressionError", Base::PyExc_FC_GeneralError, nullptr); Py_INCREF(Base::PyExc_FC_ExpressionError); PyModule_AddObject(module, "ExpressionError", Base::PyExc_FC_ExpressionError); - Base::PyExc_FC_ParserError = PyErr_NewException("Base.ParserError", PyExc_Exception, nullptr); + Base::PyExc_FC_ParserError = PyErr_NewException("Base.ParserError", Base::PyExc_FC_GeneralError, nullptr); Py_INCREF(Base::PyExc_FC_ParserError); PyModule_AddObject(module, "ParserError", Base::PyExc_FC_ParserError); - Base::PyExc_FC_CADKernelError = PyErr_NewException("Base.CADKernelError", PyExc_Exception, nullptr); + Base::PyExc_FC_CADKernelError = PyErr_NewException("Base.CADKernelError", Base::PyExc_FC_GeneralError, nullptr); Py_INCREF(Base::PyExc_FC_CADKernelError); PyModule_AddObject(module, "CADKernelError", Base::PyExc_FC_CADKernelError); } diff --git a/src/App/ApplicationPy.cpp b/src/App/ApplicationPy.cpp index 3317c70802..51a2877fa7 100644 --- a/src/App/ApplicationPy.cpp +++ b/src/App/ApplicationPy.cpp @@ -332,7 +332,7 @@ PyObject* Application::sSaveDocument(PyObject * /*self*/, PyObject *args) Document* doc = GetApplication().getDocument(pDoc); if ( doc ) { if ( doc->save() == false ) { - PyErr_Format(Base::BaseExceptionFreeCADError, "Cannot save document '%s'", pDoc); + PyErr_Format(Base::PyExc_FC_GeneralError, "Cannot save document '%s'", pDoc); return nullptr; } } @@ -790,7 +790,7 @@ PyObject *Application::sSetLogLevel(PyObject * /*self*/, PyObject *args) else if(strcmp(pstr,"Default") == 0) l = FC_LOGLEVEL_DEFAULT; else { - Py_Error(Base::BaseExceptionFreeCADError, + Py_Error(PyExc_ValueError, "Unknown Log Level (use 'Default', 'Error', 'Warning', 'Message', 'Log', 'Trace' or an integer)"); return nullptr; } diff --git a/src/App/GroupExtensionPyImp.cpp b/src/App/GroupExtensionPyImp.cpp index 0bd9d269e0..f429ea683f 100644 --- a/src/App/GroupExtensionPyImp.cpp +++ b/src/App/GroupExtensionPyImp.cpp @@ -63,22 +63,22 @@ PyObject* GroupExtensionPy::addObject(PyObject *args) DocumentObjectPy* docObj = static_cast(object); if (!docObj->getDocumentObjectPtr() || !docObj->getDocumentObjectPtr()->getNameInDocument()) { - PyErr_SetString(Base::BaseExceptionFreeCADError, "Cannot add an invalid object"); + PyErr_SetString(Base::PyExc_FC_GeneralError, "Cannot add an invalid object"); return nullptr; } if (docObj->getDocumentObjectPtr()->getDocument() != getGroupExtensionPtr()->getExtendedObject()->getDocument()) { - PyErr_SetString(Base::BaseExceptionFreeCADError, "Cannot add an object from another document to this group"); + PyErr_SetString(Base::PyExc_FC_GeneralError, "Cannot add an object from another document to this group"); return nullptr; } if (docObj->getDocumentObjectPtr() == this->getGroupExtensionPtr()->getExtendedObject()) { - PyErr_SetString(Base::BaseExceptionFreeCADError, "Cannot add a group object to itself"); + PyErr_SetString(Base::PyExc_FC_GeneralError, "Cannot add a group object to itself"); return nullptr; } if (docObj->getDocumentObjectPtr()->hasExtension(GroupExtension::getExtensionClassTypeId())) { App::GroupExtension* docGrp = docObj->getDocumentObjectPtr()->getExtensionByType(); if (docGrp->hasObject(getGroupExtensionPtr()->getExtendedObject())) { - PyErr_SetString(Base::BaseExceptionFreeCADError, "Cannot add a group object to a child group"); + PyErr_SetString(Base::PyExc_FC_GeneralError, "Cannot add a group object to a child group"); return nullptr; } } @@ -175,11 +175,11 @@ PyObject* GroupExtensionPy::removeObject(PyObject *args) DocumentObjectPy* docObj = static_cast(object); if (!docObj->getDocumentObjectPtr() || !docObj->getDocumentObjectPtr()->getNameInDocument()) { - PyErr_SetString(Base::BaseExceptionFreeCADError, "Cannot remove an invalid object"); + PyErr_SetString(Base::PyExc_FC_GeneralError, "Cannot remove an invalid object"); return nullptr; } if (docObj->getDocumentObjectPtr()->getDocument() != getGroupExtensionPtr()->getExtendedObject()->getDocument()) { - PyErr_SetString(Base::BaseExceptionFreeCADError, "Cannot remove an object from another document from this group"); + PyErr_SetString(Base::PyExc_FC_GeneralError, "Cannot remove an object from another document from this group"); return nullptr; } @@ -263,11 +263,11 @@ PyObject* GroupExtensionPy::hasObject(PyObject *args) DocumentObjectPy* docObj = static_cast(object); if (!docObj->getDocumentObjectPtr() || !docObj->getDocumentObjectPtr()->getNameInDocument()) { - PyErr_SetString(Base::BaseExceptionFreeCADError, "Cannot check an invalid object"); + PyErr_SetString(Base::PyExc_FC_GeneralError, "Cannot check an invalid object"); return nullptr; } if (docObj->getDocumentObjectPtr()->getDocument() != getGroupExtensionPtr()->getExtendedObject()->getDocument()) { - PyErr_SetString(Base::BaseExceptionFreeCADError, "Cannot check an object from another document with this group"); + PyErr_SetString(Base::PyExc_FC_GeneralError, "Cannot check an object from another document with this group"); return nullptr; } if (recursivePy) { diff --git a/src/App/MetadataPyImp.cpp b/src/App/MetadataPyImp.cpp index af3cd42645..a042d0d46e 100644 --- a/src/App/MetadataPyImp.cpp +++ b/src/App/MetadataPyImp.cpp @@ -90,7 +90,7 @@ int MetadataPy::PyInit(PyObject* args, PyObject* /*kwd*/) return -1; } catch (...) { - PyErr_SetString(Base::BaseExceptionFreeCADError, "Failed to create Metadata object"); + PyErr_SetString(Base::PyExc_FC_GeneralError, "Failed to create Metadata object"); return -1; } } @@ -104,7 +104,7 @@ int MetadataPy::PyInit(PyObject* args, PyObject* /*kwd*/) return 0; } - PyErr_SetString(Base::BaseExceptionFreeCADError, "metadata object or path to metadata file expected"); + PyErr_SetString(Base::PyExc_FC_GeneralError, "metadata object or path to metadata file expected"); return -1; } diff --git a/src/Base/BoundBoxPyImp.cpp b/src/Base/BoundBoxPyImp.cpp index ec22319b18..2414e2a664 100644 --- a/src/Base/BoundBoxPyImp.cpp +++ b/src/Base/BoundBoxPyImp.cpp @@ -324,7 +324,7 @@ PyObject* BoundBoxPy::getIntersectionPoint(PyObject *args) return new VectorPy(point); } else { - PyErr_SetString(Base::BaseExceptionFreeCADError, "No intersection"); + PyErr_SetString(Base::PyExc_FC_GeneralError, "No intersection"); return nullptr; } } diff --git a/src/Base/Console.cpp b/src/Base/Console.cpp index 8b3da64208..d10c714556 100644 --- a/src/Base/Console.cpp +++ b/src/Base/Console.cpp @@ -630,13 +630,13 @@ PyObject *ConsoleSingleton::sPySetStatus(PyObject * /*self*/, PyObject *args) else if (strcmp(pstr2,"Err") == 0) pObs->bErr = (Bool==0)?false:true; else - Py_Error(Base::BaseExceptionFreeCADError,"Unknown Message Type (use Log, Err, Msg or Wrn)"); + Py_Error(Base::PyExc_FC_GeneralError,"Unknown Message Type (use Log, Err, Msg or Wrn)"); Py_INCREF(Py_None); return Py_None; } else { - Py_Error(Base::BaseExceptionFreeCADError,"Unknown Console Type"); + Py_Error(Base::PyExc_FC_GeneralError,"Unknown Console Type"); } } PY_CATCH; diff --git a/src/Base/Exception.cpp b/src/Base/Exception.cpp index ad83699093..3e91b74f96 100644 --- a/src/Base/Exception.cpp +++ b/src/Base/Exception.cpp @@ -147,14 +147,14 @@ void Exception::setPyObject( PyObject * pydict) PyObject * Exception::getPyExceptionType() const { - return BaseExceptionFreeCADError; + return PyExc_FC_GeneralError; } void Exception::setPyException() const { PyObject* exc = getPyExceptionType(); if (!exc) { - exc = BaseExceptionFreeCADError; + exc = PyExc_FC_GeneralError; } PyErr_SetString(exc, what()); diff --git a/src/Base/MatrixPyImp.cpp b/src/Base/MatrixPyImp.cpp index 4601c04c10..0ff2d2d98f 100644 --- a/src/Base/MatrixPyImp.cpp +++ b/src/Base/MatrixPyImp.cpp @@ -633,7 +633,7 @@ PyObject* MatrixPy::invert(PyObject * args) if (fabs(getMatrixPtr()->determinant()) > DBL_EPSILON) getMatrixPtr()->inverseGauss(); else { - PyErr_SetString(Base::BaseExceptionFreeCADError, "Cannot invert singular matrix"); + PyErr_SetString(Base::PyExc_FC_GeneralError, "Cannot invert singular matrix"); return nullptr; } } @@ -654,7 +654,7 @@ PyObject* MatrixPy::inverse(PyObject * args) return new MatrixPy(m); } else { - PyErr_SetString(Base::BaseExceptionFreeCADError, "Cannot invert singular matrix"); + PyErr_SetString(Base::PyExc_FC_GeneralError, "Cannot invert singular matrix"); return nullptr; } } diff --git a/src/Base/PyObjectBase.cpp b/src/Base/PyObjectBase.cpp index c5020ef2a7..6cbefe4b0c 100644 --- a/src/Base/PyObjectBase.cpp +++ b/src/Base/PyObjectBase.cpp @@ -36,7 +36,7 @@ using namespace Base; -PyObject* Base::BaseExceptionFreeCADError = nullptr; +PyObject* Base::PyExc_FC_GeneralError = nullptr; PyObject* Base::PyExc_FC_FreeCADAbort = nullptr; PyObject* Base::PyExc_FC_XMLBaseException = nullptr; PyObject* Base::PyExc_FC_XMLParseException = nullptr; diff --git a/src/Base/PyObjectBase.h b/src/Base/PyObjectBase.h index 93ef4542d3..b66c15add8 100644 --- a/src/Base/PyObjectBase.h +++ b/src/Base/PyObjectBase.h @@ -410,9 +410,9 @@ static PyObject * s##DFUNC (PyObject *self, PyObject *args, PyObject * /*kwd*/){ */ #define PYMETHODEDEF(FUNC) {"" #FUNC "",(PyCFunction) s##FUNC,Py_NEWARGS}, -BaseExport extern PyObject* BaseExceptionFreeCADError; -#define PY_FCERROR (Base::BaseExceptionFreeCADError ? \ - BaseExceptionFreeCADError : PyExc_RuntimeError) +BaseExport extern PyObject* PyExc_FC_GeneralError; +#define PY_FCERROR (Base::PyExc_FC_GeneralError ? \ + PyExc_FC_GeneralError : PyExc_RuntimeError) BaseExport extern PyObject* PyExc_FC_FreeCADAbort; BaseExport extern PyObject* PyExc_FC_XMLBaseException; @@ -433,14 +433,14 @@ BaseExport extern PyObject* PyExc_FC_CADKernelError; * PYFUNCIMP_D(DocTypeStdPy,AddFeature) * { * char *pstr; - * if (!PyArg_ParseTuple(args, "s", &pstr)) // convert args: Python->C - * return NULL; // NULL triggers exception + * if (!PyArg_ParseTuple(args, "s", &pstr)) + * return nullptr; * * try { * Feature *pcFtr = _pcDocTypeStd->AddFeature(pstr); * }catch(...) \ * { \ - * Py_Error(Base::BaseExceptionFreeCADError,"Unknown C++ exception"); \ + * Py_Error(Base::PyExc_FC_GeneralError,"Unknown C++ exception"); \ * }catch(FCException e) ..... // and so on.... \ * } * \endcode @@ -449,8 +449,8 @@ BaseExport extern PyObject* PyExc_FC_CADKernelError; * PYFUNCIMP_D(DocTypeStdPy,AddFeature) * { * char *pstr; - * if (!PyArg_ParseTuple(args, "s", &pstr)) // convert args: Python->C - * return NULL; // NULL triggers exception + * if (!PyArg_ParseTuple(args, "s", &pstr)) + * return nullptr; * * PY_TRY { * Feature *pcFtr = _pcDocTypeStd->AddFeature(pstr); @@ -469,12 +469,12 @@ BaseExport extern PyObject* PyExc_FC_CADKernelError; { \ auto pye = e.getPyExceptionType(); \ if(!pye) \ - pye = Base::BaseExceptionFreeCADError; \ + pye = Base::PyExc_FC_GeneralError; \ _Py_ErrorObj(R,pye,e.getPyObject()); \ } \ catch(const std::exception &e) \ { \ - _Py_Error(R,Base::BaseExceptionFreeCADError,e.what()); \ + _Py_Error(R,Base::PyExc_FC_GeneralError, e.what()); \ } \ catch(const Py::Exception&) \ { \ @@ -487,7 +487,7 @@ BaseExport extern PyObject* PyExc_FC_CADKernelError; __PY_CATCH(R) \ catch(...) \ { \ - _Py_Error(R,Base::BaseExceptionFreeCADError,"Unknown C++ exception"); \ + _Py_Error(R,Base::PyExc_FC_GeneralError,"Unknown C++ exception"); \ } #else diff --git a/src/Base/RotationPyImp.cpp b/src/Base/RotationPyImp.cpp index 4ad979aeef..85da6fcab7 100644 --- a/src/Base/RotationPyImp.cpp +++ b/src/Base/RotationPyImp.cpp @@ -187,7 +187,7 @@ int RotationPy::PyInit(PyObject* args, PyObject* kwds) str += "FreeCAD exception thrown ("; str += e.what(); str += ")"; - PyErr_SetString(Base::BaseExceptionFreeCADError,str.c_str()); + PyErr_SetString(Base::PyExc_FC_GeneralError,str.c_str()); return -1; } diff --git a/src/Base/VectorPyImp.cpp b/src/Base/VectorPyImp.cpp index 9e52fab521..df5308bf98 100644 --- a/src/Base/VectorPyImp.cpp +++ b/src/Base/VectorPyImp.cpp @@ -464,7 +464,7 @@ PyObject* VectorPy::normalize(PyObject *args) return nullptr; VectorPy::PointerType ptr = reinterpret_cast(_pcTwinPointer); if (ptr->Length() < Vector3d::epsilon()) { - PyErr_SetString(Base::BaseExceptionFreeCADError, "Cannot normalize null vector"); + PyErr_SetString(Base::PyExc_FC_GeneralError, "Cannot normalize null vector"); return nullptr; } diff --git a/src/Gui/ApplicationPy.cpp b/src/Gui/ApplicationPy.cpp index aa39bb3fc8..f815fa8399 100644 --- a/src/Gui/ApplicationPy.cpp +++ b/src/Gui/ApplicationPy.cpp @@ -1007,7 +1007,7 @@ PyObject* Application::sActivateWorkbenchHandler(PyObject * /*self*/, PyObject * catch (const Base::Exception& e) { std::stringstream err; err << psKey << ": " << e.what(); - PyErr_SetString(Base::BaseExceptionFreeCADError, err.str().c_str()); + PyErr_SetString(Base::PyExc_FC_GeneralError, err.str().c_str()); return nullptr; } catch (const XERCES_CPP_NAMESPACE_QUALIFIER TranscodingException& e) { @@ -1025,7 +1025,7 @@ PyObject* Application::sActivateWorkbenchHandler(PyObject * /*self*/, PyObject * catch (...) { std::stringstream err; err << "Unknown C++ exception raised in activateWorkbench('" << psKey << "')"; - PyErr_SetString(Base::BaseExceptionFreeCADError, err.str().c_str()); + PyErr_SetString(Base::PyExc_FC_GeneralError, err.str().c_str()); return nullptr; } } @@ -1240,7 +1240,7 @@ PyObject* Application::sAddIcon(PyObject * /*self*/, PyObject *args) PyBuffer_Release(&content); if (icon.isNull()) { - PyErr_SetString(Base::BaseExceptionFreeCADError, "Invalid icon added to application"); + PyErr_SetString(Base::PyExc_FC_GeneralError, "Invalid icon added to application"); return nullptr; } @@ -1357,7 +1357,7 @@ PyObject* Application::sAddCommand(PyObject * /*self*/, PyObject *args) return nullptr; } catch (...) { - PyErr_SetString(Base::BaseExceptionFreeCADError, "Unknown C++ exception raised in Application::sAddCommand()"); + PyErr_SetString(Base::PyExc_FC_GeneralError, "Unknown C++ exception raised in Application::sAddCommand()"); return nullptr; } @@ -1380,7 +1380,7 @@ PyObject* Application::sRunCommand(PyObject * /*self*/, PyObject *args) Py_Return; } else { - PyErr_Format(Base::BaseExceptionFreeCADError, "No such command '%s'", pName); + PyErr_Format(Base::PyExc_FC_GeneralError, "No such command '%s'", pName); return nullptr; } } diff --git a/src/Gui/CommandPyImp.cpp b/src/Gui/CommandPyImp.cpp index f40a292bea..3f19bc426c 100644 --- a/src/Gui/CommandPyImp.cpp +++ b/src/Gui/CommandPyImp.cpp @@ -140,7 +140,7 @@ PyObject* CommandPy::run(PyObject *args) Py_Return; } else { - PyErr_Format(Base::BaseExceptionFreeCADError, "No such command"); + PyErr_Format(Base::PyExc_FC_GeneralError, "No such command"); return nullptr; } } @@ -158,7 +158,7 @@ PyObject* CommandPy::isActive(PyObject *args) PY_CATCH; } else { - PyErr_Format(Base::BaseExceptionFreeCADError, "No such command"); + PyErr_Format(Base::PyExc_FC_GeneralError, "No such command"); return nullptr; } } @@ -174,7 +174,7 @@ PyObject* CommandPy::getShortcut(PyObject *args) return str; } else { - PyErr_Format(Base::BaseExceptionFreeCADError, "No such command"); + PyErr_Format(Base::PyExc_FC_GeneralError, "No such command"); return nullptr; } } @@ -216,7 +216,7 @@ PyObject* CommandPy::setShortcut(PyObject *args) } } else { - PyErr_Format(Base::BaseExceptionFreeCADError, "No such command"); + PyErr_Format(Base::PyExc_FC_GeneralError, "No such command"); return nullptr; } } @@ -248,7 +248,7 @@ PyObject* CommandPy::resetShortcut(PyObject *args) } } else { - PyErr_Format(Base::BaseExceptionFreeCADError, "No such command"); + PyErr_Format(Base::PyExc_FC_GeneralError, "No such command"); return nullptr; } } @@ -286,7 +286,7 @@ PyObject* CommandPy::getInfo(PyObject *args) return pyList; } else { - PyErr_Format(Base::BaseExceptionFreeCADError, "No such command"); + PyErr_Format(Base::PyExc_FC_GeneralError, "No such command"); return nullptr; } } @@ -316,7 +316,7 @@ PyObject* CommandPy::getAction(PyObject *args) return Py::new_reference_to(list); } else { - PyErr_Format(Base::BaseExceptionFreeCADError, "No such command"); + PyErr_Format(Base::PyExc_FC_GeneralError, "No such command"); return nullptr; } } diff --git a/src/Gui/DocumentPyImp.cpp b/src/Gui/DocumentPyImp.cpp index 11024ad140..3f619f71eb 100644 --- a/src/Gui/DocumentPyImp.cpp +++ b/src/Gui/DocumentPyImp.cpp @@ -115,7 +115,7 @@ PyObject* DocumentPy::setEdit(PyObject *args) if (PyArg_ParseTuple(args, "s|is", &psFeatStr,&mod,&subname)) { obj = getDocumentPtr()->getDocument()->getObject(psFeatStr); if (!obj) { - PyErr_Format(Base::BaseExceptionFreeCADError, "No such object found in document: '%s'", psFeatStr); + PyErr_Format(Base::PyExc_FC_GeneralError, "No such object found in document: '%s'", psFeatStr); return nullptr; } } diff --git a/src/Gui/Selection.cpp b/src/Gui/Selection.cpp index cb88fe9b10..52dffe6ee0 100644 --- a/src/Gui/Selection.cpp +++ b/src/Gui/Selection.cpp @@ -2050,7 +2050,7 @@ PyObject *SelectionSingleton::sAddSelection(PyObject * /*self*/, PyObject *args) App::DocumentObjectPy* docObjPy = static_cast(object); App::DocumentObject* docObj = docObjPy->getDocumentObjectPtr(); if (!docObj || !docObj->getNameInDocument()) { - PyErr_SetString(Base::BaseExceptionFreeCADError, "Cannot check invalid object"); + PyErr_SetString(Base::PyExc_FC_GeneralError, "Cannot check invalid object"); return nullptr; } @@ -2068,7 +2068,7 @@ PyObject *SelectionSingleton::sAddSelection(PyObject * /*self*/, PyObject *args) App::DocumentObjectPy* docObjPy = static_cast(object); App::DocumentObject* docObj = docObjPy->getDocumentObjectPtr(); if (!docObj || !docObj->getNameInDocument()) { - PyErr_SetString(Base::BaseExceptionFreeCADError, "Cannot check invalid object"); + PyErr_SetString(Base::PyExc_FC_GeneralError, "Cannot check invalid object"); return nullptr; } @@ -2107,7 +2107,7 @@ PyObject *SelectionSingleton::sUpdateSelection(PyObject * /*self*/, PyObject *ar App::DocumentObjectPy* docObjPy = static_cast(object); App::DocumentObject* docObj = docObjPy->getDocumentObjectPtr(); if (!docObj || !docObj->getNameInDocument()) { - PyErr_SetString(Base::BaseExceptionFreeCADError, "Cannot check invalid object"); + PyErr_SetString(Base::PyExc_FC_GeneralError, "Cannot check invalid object"); return nullptr; } @@ -2137,7 +2137,7 @@ PyObject *SelectionSingleton::sRemoveSelection(PyObject * /*self*/, PyObject *ar App::DocumentObjectPy* docObjPy = static_cast(object); App::DocumentObject* docObj = docObjPy->getDocumentObjectPtr(); if (!docObj || !docObj->getNameInDocument()) { - PyErr_SetString(Base::BaseExceptionFreeCADError, "Cannot check invalid object"); + PyErr_SetString(Base::PyExc_FC_GeneralError, "Cannot check invalid object"); return nullptr; } @@ -2244,7 +2244,7 @@ PyObject *SelectionSingleton::sSetPreselection(PyObject * /*self*/, PyObject *ar App::DocumentObjectPy* docObjPy = static_cast(object); App::DocumentObject* docObj = docObjPy->getDocumentObjectPtr(); if (!docObj || !docObj->getNameInDocument()) { - PyErr_SetString(Base::BaseExceptionFreeCADError, "Cannot check invalid object"); + PyErr_SetString(Base::PyExc_FC_GeneralError, "Cannot check invalid object"); return nullptr; } diff --git a/src/Main/FreeCADGuiPy.cpp b/src/Main/FreeCADGuiPy.cpp index 23de8300b5..813492ff9b 100644 --- a/src/Main/FreeCADGuiPy.cpp +++ b/src/Main/FreeCADGuiPy.cpp @@ -222,7 +222,7 @@ FreeCADGui_embedToWindow(PyObject * /*self*/, PyObject *args) QWidget* widget = Gui::getMainWindow(); if (!widget) { - PyErr_SetString(Base::BaseExceptionFreeCADError, "No main window"); + PyErr_SetString(Base::PyExc_FC_GeneralError, "No main window"); return 0; } @@ -320,7 +320,7 @@ QWidget* setupMainWindow() Base::Interpreter().runString(Base::ScriptFactory().ProduceScript("FreeCADGuiInit")); } catch (const Base::Exception& e) { - PyErr_Format(Base::BaseExceptionFreeCADError, "Error in FreeCADGuiInit.py: %s\n", e.what()); + PyErr_Format(Base::PyExc_FC_GeneralError, "Error in FreeCADGuiInit.py: %s\n", e.what()); return 0; } init = true; diff --git a/src/Mod/Fem/App/FemMeshPyImp.cpp b/src/Mod/Fem/App/FemMeshPyImp.cpp index 985a94edbd..bd631f8d4a 100644 --- a/src/Mod/Fem/App/FemMeshPyImp.cpp +++ b/src/Mod/Fem/App/FemMeshPyImp.cpp @@ -100,7 +100,7 @@ int FemMeshPy::PyInit(PyObject* args, PyObject* /*kwd*/) return -1; } catch (const std::exception &e) { - PyErr_SetString(Base::BaseExceptionFreeCADError,e.what()); + PyErr_SetString(Base::PyExc_FC_GeneralError,e.what()); return -1; } catch (const Py::Exception&) { @@ -124,7 +124,7 @@ PyObject* FemMeshPy::setShape(PyObject *args) getFemMeshPtr()->getSMesh()->ShapeToMesh(shape); } catch (const std::exception& e) { - PyErr_SetString(Base::BaseExceptionFreeCADError, e.what()); + PyErr_SetString(Base::PyExc_FC_GeneralError, e.what()); return 0; } Py_Return; @@ -155,7 +155,7 @@ PyObject* FemMeshPy::addHypothesis(PyObject *args) return 0; } catch (const std::exception& e) { - PyErr_SetString(Base::BaseExceptionFreeCADError, e.what()); + PyErr_SetString(Base::PyExc_FC_GeneralError, e.what()); return 0; } Py_Return; @@ -170,7 +170,7 @@ PyObject* FemMeshPy::setStandardHypotheses(PyObject *args) getFemMeshPtr()->setStandardHypotheses(); } catch (const std::exception& e) { - PyErr_SetString(Base::BaseExceptionFreeCADError, e.what()); + PyErr_SetString(Base::PyExc_FC_GeneralError, e.what()); return 0; } Py_Return; @@ -185,7 +185,7 @@ PyObject* FemMeshPy::compute(PyObject *args) getFemMeshPtr()->compute(); } catch (const std::exception& e) { - PyErr_SetString(Base::BaseExceptionFreeCADError, e.what()); + PyErr_SetString(Base::PyExc_FC_GeneralError, e.what()); return 0; } Py_Return; @@ -205,7 +205,7 @@ PyObject* FemMeshPy::addNode(PyObject *args) return Py::new_reference_to(Py::Long(node->GetID())); } catch (const std::exception& e) { - PyErr_SetString(Base::BaseExceptionFreeCADError, e.what()); + PyErr_SetString(Base::PyExc_FC_GeneralError, e.what()); return 0; } } @@ -221,7 +221,7 @@ PyObject* FemMeshPy::addNode(PyObject *args) return Py::new_reference_to(Py::Long(node->GetID())); } catch (const std::exception& e) { - PyErr_SetString(Base::BaseExceptionFreeCADError, e.what()); + PyErr_SetString(Base::PyExc_FC_GeneralError, e.what()); return 0; } } @@ -249,7 +249,7 @@ PyObject* FemMeshPy::addEdge(PyObject *args) return Py::new_reference_to(Py::Long(edge->GetID())); } catch (const std::exception& e) { - PyErr_SetString(Base::BaseExceptionFreeCADError, e.what()); + PyErr_SetString(Base::PyExc_FC_GeneralError, e.what()); return 0; } } @@ -331,7 +331,7 @@ PyObject* FemMeshPy::addFace(PyObject *args) return Py::new_reference_to(Py::Long(face->GetID())); } catch (const std::exception& e) { - PyErr_SetString(Base::BaseExceptionFreeCADError, e.what()); + PyErr_SetString(Base::PyExc_FC_GeneralError, e.what()); return 0; } } @@ -434,7 +434,7 @@ PyObject* FemMeshPy::addQuad(PyObject *args) return Py::new_reference_to(Py::Long(face->GetID())); } catch (const std::exception& e) { - PyErr_SetString(Base::BaseExceptionFreeCADError, e.what()); + PyErr_SetString(Base::PyExc_FC_GeneralError, e.what()); return 0; } } @@ -460,7 +460,7 @@ PyObject* FemMeshPy::addVolume(PyObject *args) return Py::new_reference_to(Py::Long(vol->GetID())); } catch (const std::exception& e) { - PyErr_SetString(Base::BaseExceptionFreeCADError, e.what()); + PyErr_SetString(Base::PyExc_FC_GeneralError, e.what()); return 0; } } @@ -601,7 +601,7 @@ PyObject* FemMeshPy::read(PyObject *args) getFemMeshPtr()->read(EncodedName.c_str()); } catch (const std::exception& e) { - PyErr_SetString(Base::BaseExceptionFreeCADError, e.what()); + PyErr_SetString(Base::PyExc_FC_GeneralError, e.what()); return 0; } Py_Return; @@ -619,7 +619,7 @@ PyObject* FemMeshPy::write(PyObject *args) getFemMeshPtr()->write(EncodedName.c_str()); } catch (const std::exception& e) { - PyErr_SetString(Base::BaseExceptionFreeCADError, e.what()); + PyErr_SetString(Base::PyExc_FC_GeneralError, e.what()); return 0; } Py_Return; @@ -640,7 +640,7 @@ PyObject* FemMeshPy::writeABAQUS(PyObject *args) getFemMeshPtr()->writeABAQUS(EncodedName.c_str(), elemParam, grpParam); } catch (const std::exception& e) { - PyErr_SetString(Base::BaseExceptionFreeCADError, e.what()); + PyErr_SetString(Base::PyExc_FC_GeneralError, e.what()); return 0; } Py_Return; diff --git a/src/Mod/Fem/Gui/AppFemGuiPy.cpp b/src/Mod/Fem/Gui/AppFemGuiPy.cpp index 401685e7e6..09d5776645 100755 --- a/src/Mod/Fem/Gui/AppFemGuiPy.cpp +++ b/src/Mod/Fem/Gui/AppFemGuiPy.cpp @@ -91,7 +91,7 @@ private: if (PyArg_ParseTuple(args.ptr(),"|O!",&(App::DocumentObjectPy::Type), &object)&& object) { App::DocumentObject* obj = static_cast(object)->getDocumentObjectPtr(); if (!obj || !obj->getTypeId().isDerivedFrom(Fem::FemAnalysis::getClassTypeId())){ - throw Py::Exception(Base::BaseExceptionFreeCADError, "Active Analysis object have to be of type Fem::FemAnalysis!"); + throw Py::Exception(Base::PyExc_FC_GeneralError, "Active Analysis object have to be of type Fem::FemAnalysis!"); } // get the gui document of the Analysis Item diff --git a/src/Mod/Import/App/AppImportPy.cpp b/src/Mod/Import/App/AppImportPy.cpp index 6c327b2ea1..a3d6068ced 100644 --- a/src/Mod/Import/App/AppImportPy.cpp +++ b/src/Mod/Import/App/AppImportPy.cpp @@ -275,7 +275,7 @@ private: } } catch (Standard_Failure& e) { - throw Py::Exception(Base::BaseExceptionFreeCADError, e.GetMessageString()); + throw Py::Exception(Base::PyExc_FC_GeneralError, e.GetMessageString()); } catch (const Base::Exception& e) { e.setPyException(); @@ -396,7 +396,7 @@ private: hApp->Close(hDoc); } catch (Standard_Failure& e) { - throw Py::Exception(Base::BaseExceptionFreeCADError, e.GetMessageString()); + throw Py::Exception(Base::PyExc_FC_GeneralError, e.GetMessageString()); } catch (const Base::Exception& e) { e.setPyException(); diff --git a/src/Mod/Import/Gui/AppImportGuiPy.cpp b/src/Mod/Import/Gui/AppImportGuiPy.cpp index 3c99c19465..36dcee2578 100644 --- a/src/Mod/Import/Gui/AppImportGuiPy.cpp +++ b/src/Mod/Import/Gui/AppImportGuiPy.cpp @@ -556,7 +556,7 @@ private: } } catch (Standard_Failure& e) { - throw Py::Exception(Base::BaseExceptionFreeCADError, e.GetMessageString()); + throw Py::Exception(Base::PyExc_FC_GeneralError, e.GetMessageString()); } catch (const Base::Exception& e) { e.setPyException(); @@ -713,7 +713,7 @@ private: hApp->Close(hDoc); } catch (Standard_Failure& e) { - throw Py::Exception(Base::BaseExceptionFreeCADError, e.GetMessageString()); + throw Py::Exception(Base::PyExc_FC_GeneralError, e.GetMessageString()); } catch (const Base::Exception& e) { e.setPyException(); @@ -817,7 +817,7 @@ private: hApp->Close(hDoc); } catch (Standard_Failure& e) { - throw Py::Exception(Base::BaseExceptionFreeCADError, e.GetMessageString()); + throw Py::Exception(Base::PyExc_FC_GeneralError, e.GetMessageString()); } catch (const Base::Exception& e) { e.setPyException(); diff --git a/src/Mod/Mesh/App/MeshPyImp.cpp b/src/Mod/Mesh/App/MeshPyImp.cpp index d189bb561d..440ed4b5b3 100644 --- a/src/Mod/Mesh/App/MeshPyImp.cpp +++ b/src/Mod/Mesh/App/MeshPyImp.cpp @@ -102,7 +102,7 @@ int MeshPy::PyInit(PyObject* args, PyObject*) return -1; } catch (const std::exception &e) { - PyErr_SetString(Base::BaseExceptionFreeCADError,e.what()); + PyErr_SetString(Base::PyExc_FC_GeneralError,e.what()); return -1; } catch (const Py::Exception&) { diff --git a/src/Mod/MeshPart/App/AppMeshPartPy.cpp b/src/Mod/MeshPart/App/AppMeshPartPy.cpp index f0caaa0abf..95e9f0f2cc 100644 --- a/src/Mod/MeshPart/App/AppMeshPartPy.cpp +++ b/src/Mod/MeshPart/App/AppMeshPartPy.cpp @@ -160,7 +160,7 @@ private: if (msg) {str += msg;} else {str += "No OCCT Exception Message";} Base::Console().Error("%s\n", str.c_str()); - throw Py::Exception(Base::BaseExceptionFreeCADError, str); + throw Py::Exception(Base::PyExc_FC_GeneralError, str); } catch (const Base::Exception &e) { std::string str; diff --git a/src/Mod/Part/App/AppPart.cpp b/src/Mod/Part/App/AppPart.cpp index d231211b25..18388072d5 100644 --- a/src/Mod/Part/App/AppPart.cpp +++ b/src/Mod/Part/App/AppPart.cpp @@ -196,8 +196,8 @@ PyMOD_INIT_FUNC(Part) // Python exceptions // PyObject* OCCError = 0; - if (PyObject_IsSubclass(Base::BaseExceptionFreeCADError, PyExc_RuntimeError)) { - OCCError = PyErr_NewException("Part.OCCError", Base::BaseExceptionFreeCADError, NULL); + if (PyObject_IsSubclass(Base::PyExc_FC_GeneralError, PyExc_RuntimeError)) { + OCCError = PyErr_NewException("Part.OCCError", Base::PyExc_FC_GeneralError, NULL); } else { Base::Console().Error("Can not inherit Part.OCCError form BaseFreeCADError.\n"); diff --git a/src/Mod/Part/App/AttachEnginePyImp.cpp b/src/Mod/Part/App/AttachEnginePyImp.cpp index 63af50a3dd..d7e1424918 100644 --- a/src/Mod/Part/App/AttachEnginePyImp.cpp +++ b/src/Mod/Part/App/AttachEnginePyImp.cpp @@ -79,7 +79,7 @@ int AttachEnginePy::PyInit(PyObject* args, PyObject* /*kwd*/) if (!pNewAttacher) { std::stringstream errMsg; errMsg << "Object if this type is not derived from AttachEngine: " << typeName; - PyErr_SetString(Base::BaseExceptionFreeCADError, errMsg.str().c_str()); + PyErr_SetString(Base::PyExc_FC_GeneralError, errMsg.str().c_str()); return -1; } AttachEngine* oldAttacher = this->getAttachEnginePtr(); @@ -250,7 +250,7 @@ Py::List AttachEnginePy::getImplementedModes(void) const PyErr_SetString(Part::PartExceptionOCCError, e.GetMessageString());\ return NULL;\ } catch (Base::Exception &e) {\ - PyErr_SetString(Base::BaseExceptionFreeCADError, e.what());\ + PyErr_SetString(Base::PyExc_FC_GeneralError, e.what());\ return NULL;\ } catch (const Py::Exception &){\ return NULL;\ diff --git a/src/Mod/Part/App/TopoShapePyImp.cpp b/src/Mod/Part/App/TopoShapePyImp.cpp index 46d45dd189..6ac6efce3b 100644 --- a/src/Mod/Part/App/TopoShapePyImp.cpp +++ b/src/Mod/Part/App/TopoShapePyImp.cpp @@ -572,7 +572,7 @@ PyObject* TopoShapePy::__getstate__(PyObject *args) { PyObject* TopoShapePy::__setstate__(PyObject *args) { if (! getTopoShapePtr()) { - PyErr_SetString(Base::BaseExceptionFreeCADError,"no c++ object"); + PyErr_SetString(Base::PyExc_FC_GeneralError,"no c++ object"); return 0; } else { @@ -2926,7 +2926,7 @@ Py::String TopoShapePy::getShapeType(void) const { TopoDS_Shape sh = getTopoShapePtr()->getShape(); if (sh.IsNull()) - throw Py::Exception(Base::BaseExceptionFreeCADError, "cannot determine type of null shape"); + throw Py::Exception(Base::PyExc_FC_GeneralError, "cannot determine type of null shape"); TopAbs_ShapeEnum type = sh.ShapeType(); std::string name; switch (type) @@ -2967,7 +2967,7 @@ Py::String TopoShapePy::getOrientation(void) const { TopoDS_Shape sh = getTopoShapePtr()->getShape(); if (sh.IsNull()) - throw Py::Exception(Base::BaseExceptionFreeCADError, "cannot determine orientation of null shape"); + throw Py::Exception(Base::PyExc_FC_GeneralError, "cannot determine orientation of null shape"); TopAbs_Orientation type = sh.Orientation(); std::string name; switch (type) @@ -2993,7 +2993,7 @@ void TopoShapePy::setOrientation(Py::String arg) { TopoDS_Shape sh = getTopoShapePtr()->getShape(); if (sh.IsNull()) - throw Py::Exception(Base::BaseExceptionFreeCADError, "cannot determine orientation of null shape"); + throw Py::Exception(Base::PyExc_FC_GeneralError, "cannot determine orientation of null shape"); std::string name = (std::string)arg; TopAbs_Orientation type; if (name == "Forward") { diff --git a/src/Mod/Path/App/AppPathPy.cpp b/src/Mod/Path/App/AppPathPy.cpp index 4ab9e4dd37..9dd25a9c2d 100644 --- a/src/Mod/Path/App/AppPathPy.cpp +++ b/src/Mod/Path/App/AppPathPy.cpp @@ -76,7 +76,7 @@ str += e.what(); \ str += ")"; \ e.ReportException(); \ - PyErr_SetString(Base::BaseExceptionFreeCADError,str.c_str());\ + PyErr_SetString(Base::PyExc_FC_GeneralError,str.c_str());\ } \ catch(std::exception &e) \ { \ @@ -85,11 +85,11 @@ str += e.what(); \ str += ")"; \ Base::Console().Error(str.c_str()); \ - PyErr_SetString(Base::BaseExceptionFreeCADError,str.c_str());\ + PyErr_SetString(Base::PyExc_FC_GeneralError,str.c_str());\ } \ catch(const char *e) \ { \ - PyErr_SetString(Base::BaseExceptionFreeCADError,e); \ + PyErr_SetString(Base::PyExc_FC_GeneralError,e); \ } throw Py::Exception(); namespace Path { diff --git a/src/Mod/Path/App/FeaturePathCompoundPyImp.cpp b/src/Mod/Path/App/FeaturePathCompoundPyImp.cpp index 650de1673e..403a2e3f20 100644 --- a/src/Mod/Path/App/FeaturePathCompoundPyImp.cpp +++ b/src/Mod/Path/App/FeaturePathCompoundPyImp.cpp @@ -48,15 +48,15 @@ PyObject* FeaturePathCompoundPy::addObject(PyObject *args) DocumentObjectPy* docObj = static_cast(object); if (!docObj->getDocumentObjectPtr() || !docObj->getDocumentObjectPtr()->getNameInDocument()) { - PyErr_SetString(Base::BaseExceptionFreeCADError, "Cannot add an invalid object"); + PyErr_SetString(Base::PyExc_FC_GeneralError, "Cannot add an invalid object"); return nullptr; } if (docObj->getDocumentObjectPtr()->getDocument() != getFeaturePathCompoundPtr()->getDocument()) { - PyErr_SetString(Base::BaseExceptionFreeCADError, "Cannot add an object from another document to this group"); + PyErr_SetString(Base::PyExc_FC_GeneralError, "Cannot add an object from another document to this group"); return nullptr; } if (docObj->getDocumentObjectPtr() == this->getFeaturePathCompoundPtr()) { - PyErr_SetString(Base::BaseExceptionFreeCADError, "Cannot add a group object to itself"); + PyErr_SetString(Base::PyExc_FC_GeneralError, "Cannot add a group object to itself"); return nullptr; } @@ -93,11 +93,11 @@ PyObject* FeaturePathCompoundPy::removeObject(PyObject *args) DocumentObjectPy* docObj = static_cast(object); if (!docObj->getDocumentObjectPtr() || !docObj->getDocumentObjectPtr()->getNameInDocument()) { - PyErr_SetString(Base::BaseExceptionFreeCADError, "Cannot remove an invalid object"); + PyErr_SetString(Base::PyExc_FC_GeneralError, "Cannot remove an invalid object"); return nullptr; } if (docObj->getDocumentObjectPtr()->getDocument() != getFeaturePathCompoundPtr()->getDocument()) { - PyErr_SetString(Base::BaseExceptionFreeCADError, "Cannot remove an object from another document from this group"); + PyErr_SetString(Base::PyExc_FC_GeneralError, "Cannot remove an object from another document from this group"); return nullptr; } diff --git a/src/Tools/generateTemplates/templateClassPyExport.py b/src/Tools/generateTemplates/templateClassPyExport.py index 0881009b88..0ea79f3a25 100644 --- a/src/Tools/generateTemplates/templateClassPyExport.py +++ b/src/Tools/generateTemplates/templateClassPyExport.py @@ -572,13 +572,13 @@ PyObject * @self.export.Name@::staticCallback_@i.Name@ (PyObject *self, PyObject { auto pye = e.getPyExceptionType(); if(!pye) - pye = Base::BaseExceptionFreeCADError; - PyErr_SetObject(pye,e.getPyObject()); + pye = Base::PyExc_FC_GeneralError; + PyErr_SetObject(pye, e.getPyObject()); return nullptr; } catch(const std::exception &e) { - PyErr_SetString(Base::BaseExceptionFreeCADError,e.what()); + PyErr_SetString(Base::PyExc_FC_GeneralError, e.what()); return nullptr; } catch(const Py::Exception&) @@ -589,7 +589,7 @@ PyObject * @self.export.Name@::staticCallback_@i.Name@ (PyObject *self, PyObject #ifndef DONT_CATCH_CXX_EXCEPTIONS catch(...) { - PyErr_SetString(Base::BaseExceptionFreeCADError,"Unknown C++ exception"); + PyErr_SetString(Base::PyExc_FC_GeneralError, "Unknown C++ exception"); return nullptr; } #endif @@ -613,7 +613,7 @@ PyObject * @self.export.Name@::staticCallback_get@i.Name@ (PyObject *self, void // The exception text is already set return nullptr; } catch (...) { - PyErr_SetString(Base::BaseExceptionFreeCADError, "Unknown exception while reading attribute '@i.Name@' of object '@self.export.Twin@'"); + PyErr_SetString(Base::PyExc_FC_GeneralError, "Unknown exception while reading attribute '@i.Name@' of object '@self.export.Twin@'"); return nullptr; } } @@ -652,7 +652,7 @@ int @self.export.Name@::staticCallback_set@i.Name@ (PyObject *self, PyObject *va // The exception text is already set return -1; } catch (...) { - PyErr_SetString(Base::BaseExceptionFreeCADError, "Unknown exception while writing attribute '@i.Name@' of object '@self.export.Twin@'"); + PyErr_SetString(Base::PyExc_FC_GeneralError, "Unknown exception while writing attribute '@i.Name@' of object '@self.export.Twin@'"); return -1; } } @@ -735,13 +735,13 @@ PyObject *@self.export.Name@::_getattr(const char *attr) // __getattr__ functi { auto pye = e.getPyExceptionType(); if(!pye) - pye = Base::BaseExceptionFreeCADError; - PyErr_SetObject(pye,e.getPyObject()); + pye = Base::PyExc_FC_GeneralError; + PyErr_SetObject(pye, e.getPyObject()); return nullptr; } catch(const std::exception &e) { - PyErr_SetString(Base::BaseExceptionFreeCADError,e.what()); + PyErr_SetString(Base::PyExc_FC_GeneralError, e.what()); return nullptr; } catch(const Py::Exception&) @@ -752,7 +752,7 @@ PyObject *@self.export.Name@::_getattr(const char *attr) // __getattr__ functi #ifndef DONT_CATCH_CXX_EXCEPTIONS catch(...) { - PyErr_SetString(Base::BaseExceptionFreeCADError,"Unknown C++ exception"); + PyErr_SetString(Base::PyExc_FC_GeneralError,"Unknown C++ exception"); return nullptr; } #endif @@ -785,13 +785,13 @@ int @self.export.Name@::_setattr(const char *attr, PyObject *value) // __setattr { auto pye = e.getPyExceptionType(); if(!pye) - pye = Base::BaseExceptionFreeCADError; - PyErr_SetObject(pye,e.getPyObject()); + pye = Base::PyExc_FC_GeneralError; + PyErr_SetObject(pye, e.getPyObject()); return -1; } catch(const std::exception &e) { - PyErr_SetString(Base::BaseExceptionFreeCADError,e.what()); + PyErr_SetString(Base::PyExc_FC_GeneralError, e.what()); return -1; } catch(const Py::Exception&) @@ -802,7 +802,7 @@ int @self.export.Name@::_setattr(const char *attr, PyObject *value) // __setattr #ifndef DONT_CATCH_CXX_EXCEPTIONS catch(...) { - PyErr_SetString(Base::BaseExceptionFreeCADError,"Unknown C++ exception"); + PyErr_SetString(Base::PyExc_FC_GeneralError, "Unknown C++ exception"); return -1; } #endif