Base: rename BaseExceptionFreeCADError to PyExc_FC_GeneralError

This commit is contained in:
wmayer
2022-03-17 14:45:48 +01:00
parent 1f12dca2b4
commit e4d1ed8366
29 changed files with 114 additions and 114 deletions

View File

@@ -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;

View File

@@ -91,7 +91,7 @@ private:
if (PyArg_ParseTuple(args.ptr(),"|O!",&(App::DocumentObjectPy::Type), &object)&& object) {
App::DocumentObject* obj = static_cast<App::DocumentObjectPy*>(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

View File

@@ -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();

View File

@@ -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();

View File

@@ -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&) {

View File

@@ -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;

View File

@@ -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");

View File

@@ -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;\

View File

@@ -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") {

View File

@@ -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 {

View File

@@ -48,15 +48,15 @@ PyObject* FeaturePathCompoundPy::addObject(PyObject *args)
DocumentObjectPy* docObj = static_cast<DocumentObjectPy*>(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<DocumentObjectPy*>(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;
}