fixes #0001422: Subclass Exception
inherit Base.FreeCADError form RuntimeError inherit Part.OCCError from Base.FreeCADError inherit OCCDomainError from Part.OCCError inherit OCCRangeError from Part.OCCError inherit OCCConstructionError from OCCDomainError inherit OCCDimensionError from OCCDomainError Added PY_CATCH_OCC macro replace PyExc_Exception use FreeCADError in makeWireString catch exception in BSplineCurve.increasedegree
This commit is contained in:
@@ -84,11 +84,11 @@ int FemMeshPy::PyInit(PyObject* args, PyObject* /*kwd*/)
|
||||
}
|
||||
}
|
||||
catch (const Base::Exception &e) {
|
||||
PyErr_SetString(PyExc_Exception,e.what());
|
||||
PyErr_SetString(Base::BaseExceptionFreeCADError,e.what());
|
||||
return -1;
|
||||
}
|
||||
catch (const std::exception &e) {
|
||||
PyErr_SetString(PyExc_Exception,e.what());
|
||||
PyErr_SetString(Base::BaseExceptionFreeCADError,e.what());
|
||||
return -1;
|
||||
}
|
||||
catch (const Py::Exception&) {
|
||||
@@ -112,7 +112,7 @@ PyObject* FemMeshPy::setShape(PyObject *args)
|
||||
getFemMeshPtr()->getSMesh()->ShapeToMesh(shape);
|
||||
}
|
||||
catch (const std::exception& e) {
|
||||
PyErr_SetString(PyExc_Exception, e.what());
|
||||
PyErr_SetString(Base::BaseExceptionFreeCADError, e.what());
|
||||
return 0;
|
||||
}
|
||||
Py_Return;
|
||||
@@ -143,7 +143,7 @@ PyObject* FemMeshPy::addHypothesis(PyObject *args)
|
||||
return 0;
|
||||
}
|
||||
catch (const std::exception& e) {
|
||||
PyErr_SetString(PyExc_Exception, e.what());
|
||||
PyErr_SetString(Base::BaseExceptionFreeCADError, e.what());
|
||||
return 0;
|
||||
}
|
||||
Py_Return;
|
||||
@@ -158,7 +158,7 @@ PyObject* FemMeshPy::setStanardHypotheses(PyObject *args)
|
||||
getFemMeshPtr()->setStanardHypotheses();
|
||||
}
|
||||
catch (const std::exception& e) {
|
||||
PyErr_SetString(PyExc_Exception, e.what());
|
||||
PyErr_SetString(Base::BaseExceptionFreeCADError, e.what());
|
||||
return 0;
|
||||
}
|
||||
Py_Return;
|
||||
@@ -173,7 +173,7 @@ PyObject* FemMeshPy::compute(PyObject *args)
|
||||
getFemMeshPtr()->compute();
|
||||
}
|
||||
catch (const std::exception& e) {
|
||||
PyErr_SetString(PyExc_Exception, e.what());
|
||||
PyErr_SetString(Base::BaseExceptionFreeCADError, e.what());
|
||||
return 0;
|
||||
}
|
||||
Py_Return;
|
||||
@@ -193,7 +193,7 @@ PyObject* FemMeshPy::addNode(PyObject *args)
|
||||
return Py::new_reference_to(Py::Int(node->GetID()));
|
||||
}
|
||||
catch (const std::exception& e) {
|
||||
PyErr_SetString(PyExc_Exception, e.what());
|
||||
PyErr_SetString(Base::BaseExceptionFreeCADError, e.what());
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -209,7 +209,7 @@ PyObject* FemMeshPy::addNode(PyObject *args)
|
||||
return Py::new_reference_to(Py::Int(node->GetID()));
|
||||
}
|
||||
catch (const std::exception& e) {
|
||||
PyErr_SetString(PyExc_Exception, e.what());
|
||||
PyErr_SetString(Base::BaseExceptionFreeCADError, e.what());
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -239,7 +239,7 @@ PyObject* FemMeshPy::addEdge(PyObject *args)
|
||||
return Py::new_reference_to(Py::Int(edge->GetID()));
|
||||
}
|
||||
catch (const std::exception& e) {
|
||||
PyErr_SetString(PyExc_Exception, e.what());
|
||||
PyErr_SetString(Base::BaseExceptionFreeCADError, e.what());
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -265,7 +265,7 @@ PyObject* FemMeshPy::addFace(PyObject *args)
|
||||
return Py::new_reference_to(Py::Int(face->GetID()));
|
||||
}
|
||||
catch (const std::exception& e) {
|
||||
PyErr_SetString(PyExc_Exception, e.what());
|
||||
PyErr_SetString(Base::BaseExceptionFreeCADError, e.what());
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -330,7 +330,7 @@ PyObject* FemMeshPy::addQuad(PyObject *args)
|
||||
return Py::new_reference_to(Py::Int(face->GetID()));
|
||||
}
|
||||
catch (const std::exception& e) {
|
||||
PyErr_SetString(PyExc_Exception, e.what());
|
||||
PyErr_SetString(Base::BaseExceptionFreeCADError, e.what());
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -356,7 +356,7 @@ PyObject* FemMeshPy::addVolume(PyObject *args)
|
||||
return Py::new_reference_to(Py::Int(vol->GetID()));
|
||||
}
|
||||
catch (const std::exception& e) {
|
||||
PyErr_SetString(PyExc_Exception, e.what());
|
||||
PyErr_SetString(Base::BaseExceptionFreeCADError, e.what());
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -452,7 +452,7 @@ PyObject* FemMeshPy::read(PyObject *args)
|
||||
getFemMeshPtr()->read(filename);
|
||||
}
|
||||
catch (const std::exception& e) {
|
||||
PyErr_SetString(PyExc_Exception, e.what());
|
||||
PyErr_SetString(Base::BaseExceptionFreeCADError, e.what());
|
||||
return 0;
|
||||
}
|
||||
Py_Return;
|
||||
@@ -468,7 +468,7 @@ PyObject* FemMeshPy::write(PyObject *args)
|
||||
getFemMeshPtr()->write(filename);
|
||||
}
|
||||
catch (const std::exception& e) {
|
||||
PyErr_SetString(PyExc_Exception, e.what());
|
||||
PyErr_SetString(Base::BaseExceptionFreeCADError, e.what());
|
||||
return 0;
|
||||
}
|
||||
Py_Return;
|
||||
@@ -484,7 +484,7 @@ PyObject* FemMeshPy::writeABAQUS(PyObject *args)
|
||||
getFemMeshPtr()->writeABAQUS(filename);
|
||||
}
|
||||
catch (const std::exception& e) {
|
||||
PyErr_SetString(PyExc_Exception, e.what());
|
||||
PyErr_SetString(Base::BaseExceptionFreeCADError, e.what());
|
||||
return 0;
|
||||
}
|
||||
Py_Return;
|
||||
@@ -502,7 +502,7 @@ PyObject* FemMeshPy::setTransform(PyObject *args)
|
||||
getFemMeshPtr()->transformGeometry(mat);
|
||||
}
|
||||
catch (const std::exception& e) {
|
||||
PyErr_SetString(PyExc_Exception, e.what());
|
||||
PyErr_SetString(Base::BaseExceptionFreeCADError, e.what());
|
||||
return 0;
|
||||
}
|
||||
Py_Return;
|
||||
@@ -522,7 +522,7 @@ PyObject* FemMeshPy::getNodeById(PyObject *args)
|
||||
vec = Mtrx * vec;
|
||||
return new Base::VectorPy( vec );
|
||||
}else{
|
||||
PyErr_SetString(PyExc_Exception, "No valid ID");
|
||||
PyErr_SetString(Base::BaseExceptionFreeCADError, "No valid ID");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -537,7 +537,7 @@ PyObject* FemMeshPy::getNodesByFace(PyObject *args)
|
||||
const TopoDS_Shape& sh = static_cast<Part::TopoShapeFacePy*>(pW)->getTopoShapePtr()->_Shape;
|
||||
const TopoDS_Face& fc = TopoDS::Face(sh);
|
||||
if (sh.IsNull()) {
|
||||
PyErr_SetString(PyExc_Exception, "Face is empty");
|
||||
PyErr_SetString(Base::BaseExceptionFreeCADError, "Face is empty");
|
||||
return 0;
|
||||
}
|
||||
Py::List ret;
|
||||
@@ -550,7 +550,7 @@ PyObject* FemMeshPy::getNodesByFace(PyObject *args)
|
||||
}
|
||||
catch (Standard_Failure) {
|
||||
Handle_Standard_Failure e = Standard_Failure::Caught();
|
||||
PyErr_SetString(PyExc_Exception, e->GetMessageString());
|
||||
PyErr_SetString(Base::BaseExceptionFreeCADError, e->GetMessageString());
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user