diff --git a/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_Distribution.cpp b/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_Distribution.cpp index d10b6faa71..16f2e5be4e 100644 --- a/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_Distribution.cpp +++ b/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_Distribution.cpp @@ -65,7 +65,6 @@ bool Function::value( const double, double& f ) const #endif f = pow( 10., f ); } catch(Standard_Failure) { - Handle(Standard_Failure) aFail = Standard_Failure::Caught(); f = 0.0; ok = false; } @@ -198,7 +197,6 @@ FunctionExpr::FunctionExpr( const char* str, const int conv ) myExpr = ExprIntrp_GenExp::Create(); myExpr->Process( ( Standard_CString )str ); } catch(Standard_Failure) { - Handle(Standard_Failure) aFail = Standard_Failure::Caught(); ok = false; } @@ -233,7 +231,6 @@ bool FunctionExpr::value( const double t, double& f ) const #endif f = myExpr->Expression()->Evaluate( myVars, myValues ); } catch(Standard_Failure) { - Handle(Standard_Failure) aFail = Standard_Failure::Caught(); f = 0.0; ok = false; } diff --git a/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_NumberOfSegments.cpp b/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_NumberOfSegments.cpp index 6a530a924d..0028d23db2 100644 --- a/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_NumberOfSegments.cpp +++ b/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_NumberOfSegments.cpp @@ -240,7 +240,6 @@ void StdMeshers_NumberOfSegments::SetTableFunction(const vector& table) #endif val = pow( 10.0, val ); } catch(Standard_Failure) { - Handle(Standard_Failure) aFail = Standard_Failure::Caught(); throw SALOME_Exception( LOCALIZED( "invalid value")); return; } @@ -337,7 +336,6 @@ bool process( const TCollection_AsciiString& str, int convMode, myExpr = ExprIntrp_GenExp::Create(); myExpr->Process( str.ToCString() ); } catch(Standard_Failure) { - Handle(Standard_Failure) aFail = Standard_Failure::Caught(); parsed_ok = false; } diff --git a/src/Mod/Drawing/App/FeatureProjection.cpp b/src/Mod/Drawing/App/FeatureProjection.cpp index c76e4bc360..1ce670992c 100644 --- a/src/Mod/Drawing/App/FeatureProjection.cpp +++ b/src/Mod/Drawing/App/FeatureProjection.cpp @@ -108,8 +108,7 @@ App::DocumentObjectExecReturn *FeatureProjection::execute(void) Shape.setValue(comp); return App::DocumentObject::StdReturn; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - return new App::DocumentObjectExecReturn(e->GetMessageString()); + catch (Standard_Failure& e) { + return new App::DocumentObjectExecReturn(e.GetMessageString()); } } diff --git a/src/Mod/Drawing/App/FeatureView.cpp b/src/Mod/Drawing/App/FeatureView.cpp index a359dc246d..b7321bf0d6 100644 --- a/src/Mod/Drawing/App/FeatureView.cpp +++ b/src/Mod/Drawing/App/FeatureView.cpp @@ -72,9 +72,8 @@ App::DocumentObjectExecReturn *FeatureView::recompute(void) try { return App::DocumentObject::recompute(); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - App::DocumentObjectExecReturn* ret = new App::DocumentObjectExecReturn(e->GetMessageString()); + catch (Standard_Failure& e) { + App::DocumentObjectExecReturn* ret = new App::DocumentObjectExecReturn(e.GetMessageString()); if (ret->Why.empty()) ret->Why = "Unknown OCC exception"; return ret; } diff --git a/src/Mod/Drawing/App/FeatureViewPart.cpp b/src/Mod/Drawing/App/FeatureViewPart.cpp index 03317af7ee..bb7a4a0272 100644 --- a/src/Mod/Drawing/App/FeatureViewPart.cpp +++ b/src/Mod/Drawing/App/FeatureViewPart.cpp @@ -135,9 +135,8 @@ App::DocumentObjectExecReturn *FeatureViewPart::execute(void) return App::DocumentObject::StdReturn; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - return new App::DocumentObjectExecReturn(e->GetMessageString()); + catch (Standard_Failure& e) { + return new App::DocumentObjectExecReturn(e.GetMessageString()); } } diff --git a/src/Mod/Fem/App/FemMeshPyImp.cpp b/src/Mod/Fem/App/FemMeshPyImp.cpp index e86ca169e2..4038215154 100644 --- a/src/Mod/Fem/App/FemMeshPyImp.cpp +++ b/src/Mod/Fem/App/FemMeshPyImp.cpp @@ -700,9 +700,8 @@ PyObject* FemMeshPy::getFacesByFace(PyObject *args) return Py::new_reference_to(ret); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(Base::BaseExceptionFreeCADError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(Base::BaseExceptionFreeCADError, e.GetMessageString()); return 0; } } @@ -733,9 +732,8 @@ PyObject* FemMeshPy::getVolumesByFace(PyObject *args) return Py::new_reference_to(ret); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(Base::BaseExceptionFreeCADError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(Base::BaseExceptionFreeCADError, e.GetMessageString()); return 0; } } @@ -766,9 +764,8 @@ PyObject* FemMeshPy::getccxVolumesByFace(PyObject *args) return Py::new_reference_to(ret); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(Base::BaseExceptionFreeCADError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(Base::BaseExceptionFreeCADError, e.GetMessageString()); return 0; } } @@ -813,9 +810,8 @@ PyObject* FemMeshPy::getNodesBySolid(PyObject *args) return Py::new_reference_to(ret); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(Base::BaseExceptionFreeCADError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(Base::BaseExceptionFreeCADError, e.GetMessageString()); return 0; } } @@ -841,9 +837,8 @@ PyObject* FemMeshPy::getNodesByFace(PyObject *args) return Py::new_reference_to(ret); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(Base::BaseExceptionFreeCADError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(Base::BaseExceptionFreeCADError, e.GetMessageString()); return 0; } } @@ -869,9 +864,8 @@ PyObject* FemMeshPy::getNodesByEdge(PyObject *args) return Py::new_reference_to(ret); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(Base::BaseExceptionFreeCADError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(Base::BaseExceptionFreeCADError, e.GetMessageString()); return 0; } } @@ -897,9 +891,8 @@ PyObject* FemMeshPy::getNodesByVertex(PyObject *args) return Py::new_reference_to(ret); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(Base::BaseExceptionFreeCADError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(Base::BaseExceptionFreeCADError, e.GetMessageString()); return 0; } } @@ -919,9 +912,8 @@ PyObject* FemMeshPy::getElementNodes(PyObject *args) return Py::new_reference_to(ret); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(Base::BaseExceptionFreeCADError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(Base::BaseExceptionFreeCADError, e.GetMessageString()); return 0; } } diff --git a/src/Mod/Import/App/AppImportPy.cpp b/src/Mod/Import/App/AppImportPy.cpp index 31d195cb2b..0ee60c56b6 100644 --- a/src/Mod/Import/App/AppImportPy.cpp +++ b/src/Mod/Import/App/AppImportPy.cpp @@ -135,9 +135,8 @@ private: aReader.Transfer(hDoc); pi->EndScope(); } - catch (OSD_Exception) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - Base::Console().Error("%s\n", e->GetMessageString()); + catch (OSD_Exception& e) { + Base::Console().Error("%s\n", e.GetMessageString()); Base::Console().Message("Try to load STEP file without colors...\n"); Part::ImportStepParts(pcDoc,Utf8Name.c_str()); @@ -171,9 +170,8 @@ private: Handle(IGESToBRep_Actor)::DownCast(aReader.WS()->TransferReader()->Actor()) ->SetModel(new IGESData_IGESModel); } - catch (OSD_Exception) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - Base::Console().Error("%s\n", e->GetMessageString()); + catch (OSD_Exception& e) { + Base::Console().Error("%s\n", e.GetMessageString()); Base::Console().Message("Try to load IGES file without colors...\n"); Part::ImportIgesParts(pcDoc,Utf8Name.c_str()); @@ -194,9 +192,8 @@ private: pcDoc->recompute(); hApp->Close(hDoc); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Py::Exception(Base::BaseExceptionFreeCADError, e->GetMessageString()); + catch (Standard_Failure& e) { + throw Py::Exception(Base::BaseExceptionFreeCADError, e.GetMessageString()); } catch (const Base::Exception& e) { throw Py::RuntimeError(e.what()); @@ -307,9 +304,8 @@ private: hApp->Close(hDoc); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Py::Exception(Base::BaseExceptionFreeCADError, e->GetMessageString()); + catch (Standard_Failure& e) { + throw Py::Exception(Base::BaseExceptionFreeCADError, e.GetMessageString()); } catch (const Base::Exception& e) { throw Py::RuntimeError(e.what()); @@ -369,9 +365,8 @@ static PyObject * importAssembly(PyObject *self, PyObject *args) aReader.Transfer(hDoc); pi->EndScope(); } - catch (OSD_Exception) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - Base::Console().Error("%s\n", e->GetMessageString()); + catch (OSD_Exception& e) { + Base::Console().Error("%s\n", e.GetMessageString()); Base::Console().Message("Try to load STEP file without colors...\n"); Part::ImportStepParts(pcDoc,Name); @@ -398,9 +393,8 @@ static PyObject * importAssembly(PyObject *self, PyObject *args) aReader.Transfer(hDoc); pi->EndScope(); } - catch (OSD_Exception) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - Base::Console().Error("%s\n", e->GetMessageString()); + catch (OSD_Exception& e) { + Base::Console().Error("%s\n", e.GetMessageString()); Base::Console().Message("Try to load IGES file without colors...\n"); Part::ImportIgesParts(pcDoc,Name); @@ -417,9 +411,8 @@ static PyObject * importAssembly(PyObject *self, PyObject *args) pcDoc->recompute(); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PyExc_RuntimeError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PyExc_RuntimeError, e.GetMessageString()); return 0; } PY_CATCH diff --git a/src/Mod/Import/Gui/AppImportGuiPy.cpp b/src/Mod/Import/Gui/AppImportGuiPy.cpp index 550504545c..226820f732 100644 --- a/src/Mod/Import/Gui/AppImportGuiPy.cpp +++ b/src/Mod/Import/Gui/AppImportGuiPy.cpp @@ -365,9 +365,8 @@ private: aReader.Transfer(hDoc); pi->EndScope(); } - catch (OSD_Exception) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - Base::Console().Error("%s\n", e->GetMessageString()); + catch (OSD_Exception& e) { + Base::Console().Error("%s\n", e.GetMessageString()); Base::Console().Message("Try to load STEP file without colors...\n"); Part::ImportStepParts(pcDoc,Utf8Name.c_str()); @@ -401,9 +400,8 @@ private: Handle(IGESToBRep_Actor)::DownCast(aReader.WS()->TransferReader()->Actor()) ->SetModel(new IGESData_IGESModel); } - catch (OSD_Exception) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - Base::Console().Error("%s\n", e->GetMessageString()); + catch (OSD_Exception& e) { + Base::Console().Error("%s\n", e.GetMessageString()); Base::Console().Message("Try to load IGES file without colors...\n"); Part::ImportIgesParts(pcDoc,Utf8Name.c_str()); @@ -427,9 +425,8 @@ private: pcDoc->recompute(); hApp->Close(hDoc); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Py::Exception(Base::BaseExceptionFreeCADError, e->GetMessageString()); + catch (Standard_Failure& e) { + throw Py::Exception(Base::BaseExceptionFreeCADError, e.GetMessageString()); } catch (const Base::Exception& e) { throw Py::RuntimeError(e.what()); @@ -603,9 +600,8 @@ private: hApp->Close(hDoc); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Py::Exception(Base::BaseExceptionFreeCADError, e->GetMessageString()); + catch (Standard_Failure& e) { + throw Py::Exception(Base::BaseExceptionFreeCADError, e.GetMessageString()); } catch (const Base::Exception& e) { throw Py::RuntimeError(e.what()); @@ -697,9 +693,8 @@ private: browse.load(dlg->findChild()); hApp->Close(hDoc); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Py::Exception(Base::BaseExceptionFreeCADError, e->GetMessageString()); + catch (Standard_Failure& e) { + throw Py::Exception(Base::BaseExceptionFreeCADError, e.GetMessageString()); } catch (const Base::Exception& e) { throw Py::RuntimeError(e.what()); diff --git a/src/Mod/Measure/App/Measurement.cpp b/src/Mod/Measure/App/Measurement.cpp index 8d4d634bfc..8d96f6d172 100644 --- a/src/Mod/Measure/App/Measurement.cpp +++ b/src/Mod/Measure/App/Measurement.cpp @@ -138,11 +138,11 @@ MeasureType Measurement::getType() try { refSubShape = refShape.getSubShape((*subEl).c_str()); } - catch (Standard_Failure) { + catch (Standard_Failure& e) { std::stringstream errorMsg; - Handle(Standard_Failure) e = Standard_Failure::Caught(); - errorMsg << "Measurement - getType - " << e->GetMessageString() << std::endl; - throw Base::Exception(e->GetMessageString()); + + errorMsg << "Measurement - getType - " << e.GetMessageString() << std::endl; + throw Base::Exception(e.GetMessageString()); } switch (refSubShape.ShapeType()) { @@ -221,9 +221,9 @@ TopoDS_Shape Measurement::getShape(App::DocumentObject *obj , const char *subNam try { refSubShape = refShape.getSubShape(subName); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Base::Exception(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Base::Exception(e.GetMessageString()); } return refSubShape; } diff --git a/src/Mod/Part/App/AppPartPy.cpp b/src/Mod/Part/App/AppPartPy.cpp index f814a64744..c746985840 100644 --- a/src/Mod/Part/App/AppPartPy.cpp +++ b/src/Mod/Part/App/AppPartPy.cpp @@ -617,9 +617,8 @@ private: } } } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Py::Exception(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + throw Py::Exception(PartExceptionOCCError, e.GetMessageString()); } return Py::asObject(new TopoShapeCompoundPy(new TopoShape(Comp))); @@ -654,9 +653,8 @@ private: shape = sewShell.ApplySewing(shell); } } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Py::Exception(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + throw Py::Exception(PartExceptionOCCError, e.GetMessageString()); } return Py::asObject(new TopoShapeShellPy(new TopoShape(shape))); @@ -711,9 +709,8 @@ private: throw Py::Exception(Base::BaseExceptionFreeCADError, std::string("Argument type signature not recognized. Should be either (list, string), or (shape, string)")); - } catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Py::Exception(PartExceptionOCCError, e->GetMessageString()); + } catch (Standard_Failure& e) { + throw Py::Exception(PartExceptionOCCError, e.GetMessageString()); } catch (Base::Exception &e){ throw Py::Exception(Base::BaseExceptionFreeCADError, e.what()); } @@ -773,9 +770,8 @@ private: throw Py::Exception(PartExceptionOCCError, "Failed to created face by filling edges"); } } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Py::Exception(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + throw Py::Exception(PartExceptionOCCError, e.GetMessageString()); } } Py::Object makeSolid(const Py::Tuple& args) @@ -1065,9 +1061,8 @@ private: return Py::asObject(new TopoShapeWirePy(new TopoShape(mkPoly.Wire()))); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Py::Exception(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + throw Py::Exception(PartExceptionOCCError, e.GetMessageString()); } } Py::Object makeCircle(const Py::Tuple& args) @@ -1245,9 +1240,8 @@ private: anIsLeft, anIsVertHeight); return Py::asObject(new TopoShapeWirePy(new TopoShape(wire))); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Py::Exception(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + throw Py::Exception(PartExceptionOCCError, e.GetMessageString()); } } Py::Object makeLongHelix(const Py::Tuple& args) @@ -1265,9 +1259,8 @@ private: TopoDS_Shape wire = helix.makeLongHelix(pitch, height, radius, angle, anIsLeft); return Py::asObject(new TopoShapeWirePy(new TopoShape(wire))); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Py::Exception(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + throw Py::Exception(PartExceptionOCCError, e.GetMessageString()); } } Py::Object makeThread(const Py::Tuple& args) @@ -1281,9 +1274,8 @@ private: TopoDS_Shape wire = helix.makeThread(pitch, depth, height, radius); return Py::asObject(new TopoShapeWirePy(new TopoShape(wire))); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Py::Exception(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + throw Py::Exception(PartExceptionOCCError, e.GetMessageString()); } } Py::Object makeRevolution(const Py::Tuple& args) @@ -1447,9 +1439,8 @@ private: TopoDS_Shape face = myShape.makeTube(radius, tolerance, cont, maxdegree, maxsegment); return Py::asObject(new TopoShapeFacePy(new TopoShape(face))); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Py::Exception(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + throw Py::Exception(PartExceptionOCCError, e.GetMessageString()); } } Py::Object makeSweepSurface(const Py::Tuple& args) @@ -1472,9 +1463,8 @@ private: TopoDS_Shape face = myShape.makeSweep(prof_shape, tolerance, fillMode); return Py::asObject(new TopoShapeFacePy(new TopoShape(face))); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Py::Exception(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + throw Py::Exception(PartExceptionOCCError, e.GetMessageString()); } } Py::Object makeLoft(const Py::Tuple& args) diff --git a/src/Mod/Part/App/ArcOfCirclePyImp.cpp b/src/Mod/Part/App/ArcOfCirclePyImp.cpp index 632825e214..29cd018f5e 100644 --- a/src/Mod/Part/App/ArcOfCirclePyImp.cpp +++ b/src/Mod/Part/App/ArcOfCirclePyImp.cpp @@ -93,9 +93,8 @@ int ArcOfCirclePy::PyInit(PyObject* args, PyObject* /*kwds*/) getGeomArcOfCirclePtr()->setHandle(arc.Value()); return 0; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return -1; } catch (...) { diff --git a/src/Mod/Part/App/ArcOfEllipsePyImp.cpp b/src/Mod/Part/App/ArcOfEllipsePyImp.cpp index 2aa4c5729e..afc1f101f4 100644 --- a/src/Mod/Part/App/ArcOfEllipsePyImp.cpp +++ b/src/Mod/Part/App/ArcOfEllipsePyImp.cpp @@ -104,9 +104,8 @@ int ArcOfEllipsePy::PyInit(PyObject* args, PyObject* /*kwds*/) getGeomArcOfEllipsePtr()->setHandle(arc.Value()); return 0; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return -1; } catch (...) { diff --git a/src/Mod/Part/App/ArcOfHyperbolaPyImp.cpp b/src/Mod/Part/App/ArcOfHyperbolaPyImp.cpp index 7e9f0bfb80..d171a9cac4 100644 --- a/src/Mod/Part/App/ArcOfHyperbolaPyImp.cpp +++ b/src/Mod/Part/App/ArcOfHyperbolaPyImp.cpp @@ -104,9 +104,8 @@ int ArcOfHyperbolaPy::PyInit(PyObject* args, PyObject* /*kwds*/) getGeomArcOfHyperbolaPtr()->setHandle(arc.Value()); return 0; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return -1; } catch (...) { diff --git a/src/Mod/Part/App/ArcOfParabolaPyImp.cpp b/src/Mod/Part/App/ArcOfParabolaPyImp.cpp index 6cfca96536..950a490c24 100644 --- a/src/Mod/Part/App/ArcOfParabolaPyImp.cpp +++ b/src/Mod/Part/App/ArcOfParabolaPyImp.cpp @@ -102,9 +102,8 @@ int ArcOfParabolaPy::PyInit(PyObject* args, PyObject* /*kwds*/) getGeomArcOfParabolaPtr()->setHandle(arc.Value()); return 0; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return -1; } catch (...) { diff --git a/src/Mod/Part/App/ArcPyImp.cpp b/src/Mod/Part/App/ArcPyImp.cpp index 787ed8398c..5e324a2691 100644 --- a/src/Mod/Part/App/ArcPyImp.cpp +++ b/src/Mod/Part/App/ArcPyImp.cpp @@ -87,9 +87,8 @@ int ArcPy::PyInit(PyObject* args, PyObject* /*kwd*/) getGeomTrimmedCurvePtr()->setHandle(arc.Value()); return 0; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return -1; } catch (...) { @@ -133,9 +132,8 @@ int ArcPy::PyInit(PyObject* args, PyObject* /*kwd*/) getGeomTrimmedCurvePtr()->setHandle(arc.Value()); return 0; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return -1; } catch (...) { @@ -159,9 +157,8 @@ int ArcPy::PyInit(PyObject* args, PyObject* /*kwd*/) getGeomTrimmedCurvePtr()->setHandle(arc.Value()); return 0; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return -1; } catch (...) { @@ -185,9 +182,8 @@ int ArcPy::PyInit(PyObject* args, PyObject* /*kwd*/) getGeomTrimmedCurvePtr()->setHandle(arc.Value()); return 0; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return -1; } catch (...) { diff --git a/src/Mod/Part/App/AttachEnginePyImp.cpp b/src/Mod/Part/App/AttachEnginePyImp.cpp index 4169b200f4..a0a312fb79 100644 --- a/src/Mod/Part/App/AttachEnginePyImp.cpp +++ b/src/Mod/Part/App/AttachEnginePyImp.cpp @@ -83,9 +83,8 @@ Py::String AttachEnginePy::getAttacherType(void) const * to avoid repeating the same error handling code over and over again. */ #define ATTACHERPY_STDCATCH_ATTR \ - catch (Standard_Failure) {\ - Handle(Standard_Failure) e = Standard_Failure::Caught();\ - throw Py::Exception(Part::PartExceptionOCCError, e->GetMessageString());\ + catch (Standard_Failure& e) {\ + throw Py::Exception(Part::PartExceptionOCCError, e.GetMessageString());\ } catch (Base::Exception &e) {\ throw Py::Exception(Base::BaseExceptionFreeCADError, e.what());\ } @@ -224,9 +223,8 @@ Py::List AttachEnginePy::getImplementedModes(void) const * the same error handling code over and over again. */ #define ATTACHERPY_STDCATCH_METH \ - catch (Standard_Failure) {\ - Handle(Standard_Failure) e = Standard_Failure::Caught();\ - PyErr_SetString(Part::PartExceptionOCCError, e->GetMessageString());\ + catch (Standard_Failure& e) {\ + PyErr_SetString(Part::PartExceptionOCCError, e.GetMessageString());\ return NULL;\ } catch (Base::Exception &e) {\ PyErr_SetString(Base::BaseExceptionFreeCADError, e.what());\ diff --git a/src/Mod/Part/App/AttachExtensionPyImp.cpp b/src/Mod/Part/App/AttachExtensionPyImp.cpp index e6c755159f..e4e25d92bb 100644 --- a/src/Mod/Part/App/AttachExtensionPyImp.cpp +++ b/src/Mod/Part/App/AttachExtensionPyImp.cpp @@ -25,9 +25,8 @@ PyObject* AttachExtensionPy::positionBySupport(PyObject *args) bool bAttached = false; try{ bAttached = this->getAttachExtensionPtr()->positionBySupport(); - } catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + } catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return NULL; } catch (Base::Exception &e) { PyErr_SetString(Base::BaseExceptionFreeCADError, e.what()); @@ -44,9 +43,8 @@ PyObject* AttachExtensionPy::changeAttacherType(PyObject *args) bool ret; try{ ret = this->getAttachExtensionPtr()->changeAttacherType(typeName); - } catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + } catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return NULL; } catch (Base::Exception &e) { PyErr_SetString(Base::BaseExceptionFreeCADError, e.what()); @@ -65,9 +63,8 @@ Py::Object AttachExtensionPy::getAttacher(void) const try { return Py::Object( new Attacher::AttachEnginePy(this->getAttachExtensionPtr()->attacher().copy()), true); - } catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Py::Exception(Part::PartExceptionOCCError, e->GetMessageString()); + } catch (Standard_Failure& e) { + throw Py::Exception(Part::PartExceptionOCCError, e.GetMessageString()); } catch (Base::Exception &e) { throw Py::Exception(Base::BaseExceptionFreeCADError, e.what()); } diff --git a/src/Mod/Part/App/BRepOffsetAPI_MakePipeShellPyImp.cpp b/src/Mod/Part/App/BRepOffsetAPI_MakePipeShellPyImp.cpp index 2069d12ba9..618e6f20a1 100644 --- a/src/Mod/Part/App/BRepOffsetAPI_MakePipeShellPyImp.cpp +++ b/src/Mod/Part/App/BRepOffsetAPI_MakePipeShellPyImp.cpp @@ -81,9 +81,8 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::setFrenetMode(PyObject *args) this->getBRepOffsetAPI_MakePipeShellPtr()->SetMode(PyObject_IsTrue(obj) ? Standard_True : Standard_False); Py_Return; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -101,9 +100,8 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::setTrihedronMode(PyObject *args) this->getBRepOffsetAPI_MakePipeShellPtr()->SetMode(gp_Ax2(p,d)); Py_Return; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -119,9 +117,8 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::setBiNormalMode(PyObject *args) this->getBRepOffsetAPI_MakePipeShellPtr()->SetMode(d); Py_Return; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -137,9 +134,8 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::setSpineSupport(PyObject *args) Standard_Boolean ok = this->getBRepOffsetAPI_MakePipeShellPtr()->SetMode(s); return Py::new_reference_to(Py::Boolean(ok ? true : false)); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -178,9 +174,8 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::setAuxiliarySpine(PyObject *args) typeOfCantact); Py_Return; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } #else @@ -203,9 +198,8 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::setAuxiliarySpine(PyObject *args) PyObject_IsTrue(keep) ? Standard_True : Standard_False); Py_Return; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } #endif @@ -226,9 +220,8 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::add(PyObject *args, PyObject *kwds) PyObject_IsTrue(keep) ? Standard_True : Standard_False); Py_Return; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -249,9 +242,8 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::add(PyObject *args, PyObject *kwds) PyObject_IsTrue(keep) ? Standard_True : Standard_False); Py_Return; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -274,9 +266,8 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::remove(PyObject *args) this->getBRepOffsetAPI_MakePipeShellPtr()->Delete(s); Py_Return; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -290,9 +281,8 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::isReady(PyObject *args) Standard_Boolean ok = this->getBRepOffsetAPI_MakePipeShellPtr()->IsReady(); return Py::new_reference_to(Py::Boolean(ok ? true : false)); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -306,9 +296,8 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::getStatus(PyObject *args) Standard_Integer val = this->getBRepOffsetAPI_MakePipeShellPtr()->GetStatus(); return Py::new_reference_to(Py::Long(val)); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -322,9 +311,8 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::makeSolid(PyObject *args) Standard_Boolean ok = this->getBRepOffsetAPI_MakePipeShellPtr()->MakeSolid(); return Py::new_reference_to(Py::Boolean(ok ? true : false)); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -338,9 +326,8 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::build(PyObject *args) this->getBRepOffsetAPI_MakePipeShellPtr()->Build(); Py_Return; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -354,9 +341,8 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::shape(PyObject *args) const TopoDS_Shape& shape = this->getBRepOffsetAPI_MakePipeShellPtr()->Shape(); return new TopoShapePy(new TopoShape(shape)); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -370,9 +356,8 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::firstShape(PyObject *args) TopoDS_Shape shape = this->getBRepOffsetAPI_MakePipeShellPtr()->FirstShape(); return new TopoShapePy(new TopoShape(shape)); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -386,9 +371,8 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::lastShape(PyObject *args) TopoDS_Shape shape = this->getBRepOffsetAPI_MakePipeShellPtr()->LastShape(); return new TopoShapePy(new TopoShape(shape)); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -411,9 +395,8 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::generated(PyObject *args) } return Py::new_reference_to(shapes); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -428,9 +411,8 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::setTolerance(PyObject *args) this->getBRepOffsetAPI_MakePipeShellPtr()->SetTolerance(tol3d, boundTol, tolAngular); Py_Return; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -445,9 +427,8 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::setTransitionMode(PyObject *args) this->getBRepOffsetAPI_MakePipeShellPtr()->SetTransitionMode(BRepBuilderAPI_TransitionMode(mode)); Py_Return; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -468,9 +449,8 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::setMaxDegree(PyObject *args) return 0; #endif } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -491,9 +471,8 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::setMaxSegments(PyObject *args) return 0; #endif } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -513,9 +492,8 @@ PyObject* BRepOffsetAPI_MakePipeShellPy::setForceApproxC1(PyObject *args) return 0; #endif } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } diff --git a/src/Mod/Part/App/BSplineCurvePyImp.cpp b/src/Mod/Part/App/BSplineCurvePyImp.cpp index 82e48d3ad8..e41c80d0bd 100644 --- a/src/Mod/Part/App/BSplineCurvePyImp.cpp +++ b/src/Mod/Part/App/BSplineCurvePyImp.cpp @@ -181,9 +181,8 @@ PyObject* BSplineCurvePy::increaseMultiplicity(PyObject * args) Py_Return; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -199,9 +198,8 @@ PyObject* BSplineCurvePy::incrementMultiplicity(PyObject * args) (getGeometryPtr()->handle()); curve->IncrementMultiplicity(start, end, mult); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } @@ -221,9 +219,8 @@ PyObject* BSplineCurvePy::insertKnot(PyObject * args) (getGeometryPtr()->handle()); curve->InsertKnot(U,M,tol,PyObject_IsTrue(add) ? Standard_True : Standard_False); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } @@ -266,9 +263,8 @@ PyObject* BSplineCurvePy::insertKnots(PyObject * args) curve->InsertKnots(k,m,tol,PyObject_IsTrue(add) ? Standard_True : Standard_False); Py_Return; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } @@ -288,9 +284,8 @@ PyObject* BSplineCurvePy::removeKnot(PyObject * args) Standard_Boolean ok = curve->RemoveKnot(Index,M,tol); return PyBool_FromLong(ok ? 1 : 0); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -306,9 +301,8 @@ PyObject* BSplineCurvePy::segment(PyObject * args) curve->Segment(u1,u2); Py_Return; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -332,9 +326,8 @@ PyObject* BSplineCurvePy::setKnot(PyObject * args) Py_Return; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -352,9 +345,8 @@ PyObject* BSplineCurvePy::getKnot(PyObject * args) return Py_BuildValue("d",M); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -378,9 +370,8 @@ PyObject* BSplineCurvePy::setKnots(PyObject * args) curve->SetKnots(k); Py_Return; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -400,9 +391,8 @@ PyObject* BSplineCurvePy::getKnots(PyObject * args) } return Py::new_reference_to(knots); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -425,9 +415,8 @@ PyObject* BSplineCurvePy::setPole(PyObject * args) curve->SetPole(index,pnt,weight); Py_Return; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -447,9 +436,8 @@ PyObject* BSplineCurvePy::getPole(PyObject * args) pnt.X(), pnt.Y(), pnt.Z())); return vec; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -472,9 +460,8 @@ PyObject* BSplineCurvePy::getPoles(PyObject * args) } return Py::new_reference_to(poles); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -504,9 +491,8 @@ PyObject* BSplineCurvePy::getPolesAndWeights(PyObject * args) } return Py::new_reference_to(poles); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -523,9 +509,8 @@ PyObject* BSplineCurvePy::setWeight(PyObject * args) curve->SetWeight(index,weight); Py_Return; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -543,9 +528,8 @@ PyObject* BSplineCurvePy::getWeight(PyObject * args) double weight = curve->Weight(index); return Py_BuildValue("d", weight); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -565,9 +549,8 @@ PyObject* BSplineCurvePy::getWeights(PyObject * args) } return Py::new_reference_to(weights); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -584,9 +567,8 @@ PyObject* BSplineCurvePy::getResolution(PyObject * args) curve->Resolution(tol,utol); return Py_BuildValue("d",utol); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -606,9 +588,8 @@ PyObject* BSplineCurvePy::movePoint(PyObject * args) curve->MovePoint(U, gp_Pnt(p.x,p.y,p.z), index1, index2, first, last); return Py_BuildValue("(ii)",first, last); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -623,9 +604,8 @@ PyObject* BSplineCurvePy::setNotPeriodic(PyObject * args) curve->SetNotPeriodic(); Py_Return; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -640,9 +620,8 @@ PyObject* BSplineCurvePy::setPeriodic(PyObject * args) curve->SetPeriodic(); Py_Return; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -658,9 +637,8 @@ PyObject* BSplineCurvePy::setOrigin(PyObject * args) curve->SetOrigin(index); Py_Return; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -676,9 +654,8 @@ PyObject* BSplineCurvePy::getMultiplicity(PyObject * args) int mult = curve->Multiplicity(index); return Py_BuildValue("i", mult); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -698,9 +675,8 @@ PyObject* BSplineCurvePy::getMultiplicities(PyObject * args) } return Py::new_reference_to(mults); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -804,9 +780,8 @@ PyObject* BSplineCurvePy::toBiArcs(PyObject * args) return Py::new_reference_to(list); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -921,9 +896,8 @@ PyObject* BSplineCurvePy::approximate(PyObject *args, PyObject *kwds) return 0; // goes to the catch block } } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -1083,10 +1057,9 @@ PyObject* BSplineCurvePy::interpolate(PyObject *args, PyObject *kwds) return 0; // goes to the catch block } } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - std::string err = e->GetMessageString(); - if (err.empty()) err = e->DynamicType()->Name(); + catch (Standard_Failure& e) { + std::string err = e.GetMessageString(); + if (err.empty()) err = e.DynamicType()->Name(); PyErr_SetString(PartExceptionOCCError, err.c_str()); return 0; } @@ -1164,9 +1137,8 @@ PyObject* BSplineCurvePy::buildFromPoles(PyObject *args) } } } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -1310,9 +1282,8 @@ PyObject* BSplineCurvePy::buildFromPolesMultsKnots(PyObject *args, PyObject *key return 0; // goes to the catch block } } - catch (const Standard_Failure & ) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - Standard_CString msg = e->GetMessageString(); + catch (const Standard_Failure& e) { + Standard_CString msg = e.GetMessageString(); PyErr_SetString(PartExceptionOCCError, msg ? msg : ""); return 0; } @@ -1338,9 +1309,8 @@ PyObject* BSplineCurvePy::toBezier(PyObject *args) return Py::new_reference_to(list); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -1361,9 +1331,8 @@ PyObject* BSplineCurvePy::join(PyObject *args) return PyBool_FromLong(ok ? 1 : 0); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -1380,10 +1349,9 @@ PyObject* BSplineCurvePy::makeC1Continuous(PyObject *args) spline->makeC1Continuous(tol, ang_tol); Py_Return; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - std::string err = e->GetMessageString(); - if (err.empty()) err = e->DynamicType()->Name(); + catch (Standard_Failure& e) { + std::string err = e.GetMessageString(); + if (err.empty()) err = e.DynamicType()->Name(); PyErr_SetString(PartExceptionOCCError, err.c_str()); return 0; } diff --git a/src/Mod/Part/App/BSplineSurfacePyImp.cpp b/src/Mod/Part/App/BSplineSurfacePyImp.cpp index a04550bd4c..374e4d4260 100644 --- a/src/Mod/Part/App/BSplineSurfacePyImp.cpp +++ b/src/Mod/Part/App/BSplineSurfacePyImp.cpp @@ -212,9 +212,8 @@ PyObject* BSplineSurfacePy::incrementUMultiplicity(PyObject *args) (getGeometryPtr()->handle()); surf->IncrementUMultiplicity(start, end, mult); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } @@ -232,9 +231,8 @@ PyObject* BSplineSurfacePy::incrementVMultiplicity(PyObject *args) (getGeometryPtr()->handle()); surf->IncrementVMultiplicity(start, end, mult); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } @@ -254,9 +252,8 @@ PyObject* BSplineSurfacePy::insertUKnot(PyObject *args) (getGeometryPtr()->handle()); surf->InsertUKnot(U,M,tol,PyObject_IsTrue(add) ? Standard_True : Standard_False); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } @@ -299,9 +296,8 @@ PyObject* BSplineSurfacePy::insertUKnots(PyObject *args) surf->InsertUKnots(k,m,tol,PyObject_IsTrue(add) ? Standard_True : Standard_False); Py_Return; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } @@ -321,9 +317,8 @@ PyObject* BSplineSurfacePy::insertVKnot(PyObject *args) (getGeometryPtr()->handle()); surf->InsertVKnot(V,M,tol,PyObject_IsTrue(add) ? Standard_True : Standard_False); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } @@ -366,9 +361,8 @@ PyObject* BSplineSurfacePy::insertVKnots(PyObject *args) surf->InsertVKnots(k,m,tol,PyObject_IsTrue(add) ? Standard_True : Standard_False); Py_Return; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } @@ -388,9 +382,8 @@ PyObject* BSplineSurfacePy::removeUKnot(PyObject *args) Standard_Boolean ok = surf->RemoveUKnot(Index,M,tol); return PyBool_FromLong(ok ? 1 : 0); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -408,9 +401,8 @@ PyObject* BSplineSurfacePy::removeVKnot(PyObject *args) Standard_Boolean ok = surf->RemoveVKnot(Index,M,tol); return PyBool_FromLong(ok ? 1 : 0); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -426,9 +418,9 @@ PyObject* BSplineSurfacePy::segment(PyObject *args) surf->Segment(u1,u2,v1,v2); Py_Return; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -516,9 +508,8 @@ PyObject* BSplineSurfacePy::setUKnots(PyObject *args) surf->SetUKnots(k); Py_Return; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -542,9 +533,8 @@ PyObject* BSplineSurfacePy::setVKnots(PyObject *args) surf->SetVKnots(k); Py_Return; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -564,9 +554,8 @@ PyObject* BSplineSurfacePy::getUKnots(PyObject *args) } return Py::new_reference_to(knots); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -586,9 +575,8 @@ PyObject* BSplineSurfacePy::getVKnots(PyObject *args) } return Py::new_reference_to(knots); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -611,9 +599,8 @@ PyObject* BSplineSurfacePy::setPole(PyObject *args) surf->SetPole(uindex,vindex,pnt,weight); Py_Return; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -652,9 +639,8 @@ PyObject* BSplineSurfacePy::setPoleCol(PyObject *args) Py_Return; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -693,9 +679,8 @@ PyObject* BSplineSurfacePy::setPoleRow(PyObject *args) Py_Return; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -716,9 +701,8 @@ PyObject* BSplineSurfacePy::getPole(PyObject *args) pnt.X(), pnt.Y(), pnt.Z())); return vec; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -744,9 +728,8 @@ PyObject* BSplineSurfacePy::getPoles(PyObject *args) } return Py::new_reference_to(poles); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -763,9 +746,8 @@ PyObject* BSplineSurfacePy::setWeight(PyObject *args) surf->SetWeight(uindex,vindex,weight); Py_Return; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -789,9 +771,8 @@ PyObject* BSplineSurfacePy::setWeightCol(PyObject *args) surf->SetWeightCol(vindex, weights); Py_Return; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -815,9 +796,8 @@ PyObject* BSplineSurfacePy::setWeightRow(PyObject *args) surf->SetWeightRow(uindex, weights); Py_Return; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -836,9 +816,8 @@ PyObject* BSplineSurfacePy::getWeight(PyObject *args) double w = surf->Weight(uindex,vindex); return Py_BuildValue("d", w); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -862,9 +841,8 @@ PyObject* BSplineSurfacePy::getWeights(PyObject *args) } return Py::new_reference_to(weights); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -898,9 +876,8 @@ PyObject* BSplineSurfacePy::getPolesAndWeights(PyObject *args) } return Py::new_reference_to(poles); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -917,9 +894,8 @@ PyObject* BSplineSurfacePy::getResolution(PyObject *args) surf->Resolution(tol,utol,vtol); return Py_BuildValue("(dd)",utol,vtol); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -942,9 +918,8 @@ PyObject* BSplineSurfacePy::movePoint(PyObject *args) ufirst, ulast, vfirst, vlast); return Py_BuildValue("(iiii)",ufirst, ulast, vfirst, vlast); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -959,9 +934,8 @@ PyObject* BSplineSurfacePy::setUNotPeriodic(PyObject *args) surf->SetUNotPeriodic(); Py_Return; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -976,9 +950,8 @@ PyObject* BSplineSurfacePy::setVNotPeriodic(PyObject *args) surf->SetVNotPeriodic(); Py_Return; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -993,9 +966,8 @@ PyObject* BSplineSurfacePy::setUPeriodic(PyObject *args) surf->SetUPeriodic(); Py_Return; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -1010,9 +982,8 @@ PyObject* BSplineSurfacePy::setVPeriodic(PyObject *args) surf->SetVPeriodic(); Py_Return; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -1028,9 +999,8 @@ PyObject* BSplineSurfacePy::setUOrigin(PyObject *args) surf->SetUOrigin(index); Py_Return; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -1046,9 +1016,8 @@ PyObject* BSplineSurfacePy::setVOrigin(PyObject *args) surf->SetVOrigin(index); Py_Return; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -1064,9 +1033,8 @@ PyObject* BSplineSurfacePy::getUMultiplicity(PyObject *args) int mult = surf->UMultiplicity(index); return Py_BuildValue("i", mult); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -1082,9 +1050,8 @@ PyObject* BSplineSurfacePy::getVMultiplicity(PyObject *args) int mult = surf->VMultiplicity(index); return Py_BuildValue("i", mult); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -1104,9 +1071,8 @@ PyObject* BSplineSurfacePy::getUMultiplicities(PyObject *args) } return Py::new_reference_to(mults); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -1126,9 +1092,8 @@ PyObject* BSplineSurfacePy::getVMultiplicities(PyObject *args) } return Py::new_reference_to(mults); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -1156,9 +1121,8 @@ PyObject* BSplineSurfacePy::uIso(PyObject * args) Handle(Geom_Curve) c = surf->UIso(u); return new BSplineCurvePy(new GeomBSplineCurve(Handle(Geom_BSplineCurve)::DownCast(c))); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -1175,9 +1139,8 @@ PyObject* BSplineSurfacePy::vIso(PyObject * args) Handle(Geom_Curve) c = surf->VIso(v); return new BSplineCurvePy(new GeomBSplineCurve(Handle(Geom_BSplineCurve)::DownCast(c))); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -1228,9 +1191,8 @@ PyObject* BSplineSurfacePy::reparametrize(PyObject * args) return new BSplineSurfacePy(geom); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -1339,18 +1301,14 @@ PyObject* BSplineSurfacePy::approximate(PyObject *args, PyObject *kwds) this->getGeomBSplineSurfacePtr()->setHandle(sur); Py_Return; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - std::string err = e->GetMessageString(); - if (err.empty()) err = e->DynamicType()->Name(); + catch (Standard_Failure& e) { + std::string err = e.GetMessageString(); + if (err.empty()) err = e.DynamicType()->Name(); PyErr_SetString(PartExceptionOCCError, err.c_str()); return 0; } } - - - PyObject* BSplineSurfacePy::interpolate(PyObject *args) { PyObject* obj; @@ -1407,10 +1365,9 @@ PyObject* BSplineSurfacePy::interpolate(PyObject *args) this->getGeomBSplineSurfacePtr()->setHandle(sur); Py_Return; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - std::string err = e->GetMessageString(); - if (err.empty()) err = e->DynamicType()->Name(); + catch (Standard_Failure& e) { + std::string err = e.GetMessageString(); + if (err.empty()) err = e.DynamicType()->Name(); PyErr_SetString(PartExceptionOCCError, err.c_str()); return 0; } @@ -1571,13 +1528,13 @@ PyObject* BSplineSurfacePy::buildFromPolesMultsKnots(PyObject *args, PyObject *k } } - catch (const Standard_Failure & ) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - Standard_CString msg = e->GetMessageString(); + catch (const Standard_Failure& e) { + Standard_CString msg = e.GetMessageString(); PyErr_SetString(PartExceptionOCCError, msg ? msg : ""); return 0; - } + } } + Py::Long BSplineSurfacePy::getUDegree(void) const { Handle(Geom_BSplineSurface) surf = Handle(Geom_BSplineSurface)::DownCast diff --git a/src/Mod/Part/App/BezierCurvePyImp.cpp b/src/Mod/Part/App/BezierCurvePyImp.cpp index 69c2c2b888..975f2fab2e 100644 --- a/src/Mod/Part/App/BezierCurvePyImp.cpp +++ b/src/Mod/Part/App/BezierCurvePyImp.cpp @@ -113,9 +113,8 @@ PyObject* BezierCurvePy::insertPoleAfter(PyObject * args) curve->InsertPoleAfter(index,pnt,weight); Py_Return; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -135,9 +134,8 @@ PyObject* BezierCurvePy::insertPoleBefore(PyObject * args) curve->InsertPoleBefore(index,pnt,weight); Py_Return; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -153,9 +151,8 @@ PyObject* BezierCurvePy::removePole(PyObject * args) curve->RemovePole(index); Py_Return; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -171,9 +168,8 @@ PyObject* BezierCurvePy::segment(PyObject * args) curve->Segment(u1,u2); Py_Return; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -196,9 +192,8 @@ PyObject* BezierCurvePy::setPole(PyObject * args) curve->SetPole(index,pnt,weight); Py_Return; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -218,9 +213,8 @@ PyObject* BezierCurvePy::getPole(PyObject * args) pnt.X(), pnt.Y(), pnt.Z())); return vec; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -243,9 +237,8 @@ PyObject* BezierCurvePy::getPoles(PyObject * args) } return Py::new_reference_to(poles); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -269,9 +262,8 @@ PyObject* BezierCurvePy::setPoles(PyObject * args) this->getGeomBezierCurvePtr()->setHandle(bezier); Py_Return; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -288,9 +280,8 @@ PyObject* BezierCurvePy::setWeight(PyObject * args) curve->SetWeight(index,weight); Py_Return; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -308,9 +299,8 @@ PyObject* BezierCurvePy::getWeight(PyObject * args) double weight = curve->Weight(index); return Py_BuildValue("d", weight); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -330,9 +320,8 @@ PyObject* BezierCurvePy::getWeights(PyObject * args) } return Py::new_reference_to(weights); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -349,9 +338,8 @@ PyObject* BezierCurvePy::getResolution(PyObject* args) curve->Resolution(tol,utol); return Py_BuildValue("d",utol); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } diff --git a/src/Mod/Part/App/BezierSurfacePyImp.cpp b/src/Mod/Part/App/BezierSurfacePyImp.cpp index 07d651f406..b3891bd3b4 100644 --- a/src/Mod/Part/App/BezierSurfacePyImp.cpp +++ b/src/Mod/Part/App/BezierSurfacePyImp.cpp @@ -155,9 +155,9 @@ PyObject* BezierSurfacePy::increase(PyObject *args) surf->Increase(udegree, vdegree); Py_Return; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -196,9 +196,8 @@ PyObject* BezierSurfacePy::insertPoleColAfter(PyObject *args) Py_Return; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -237,9 +236,8 @@ PyObject* BezierSurfacePy::insertPoleRowAfter(PyObject *args) Py_Return; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -278,9 +276,8 @@ PyObject* BezierSurfacePy::insertPoleColBefore(PyObject *args) Py_Return; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -319,9 +316,8 @@ PyObject* BezierSurfacePy::insertPoleRowBefore(PyObject *args) Py_Return; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -337,9 +333,8 @@ PyObject* BezierSurfacePy::removePoleCol(PyObject *args) surf->RemovePoleCol(vindex); Py_Return; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -355,9 +350,8 @@ PyObject* BezierSurfacePy::removePoleRow(PyObject *args) surf->RemovePoleRow(uindex); Py_Return; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -373,9 +367,8 @@ PyObject* BezierSurfacePy::segment(PyObject *args) surf->Segment(u1,u2,v1,v2); Py_Return; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -397,9 +390,8 @@ PyObject* BezierSurfacePy::setPole(PyObject *args) surf->SetPole(uindex,vindex,gp_Pnt(pole.x,pole.y,pole.z),weight); Py_Return; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -438,9 +430,8 @@ PyObject* BezierSurfacePy::setPoleCol(PyObject *args) Py_Return; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -479,9 +470,8 @@ PyObject* BezierSurfacePy::setPoleRow(PyObject *args) Py_Return; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -500,9 +490,8 @@ PyObject* BezierSurfacePy::getPole(PyObject *args) gp_Pnt p = surf->Pole(uindex,vindex); return new Base::VectorPy(Base::Vector3d(p.X(),p.Y(),p.Z())); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -528,9 +517,8 @@ PyObject* BezierSurfacePy::getPoles(PyObject *args) } return Py::new_reference_to(poles); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -547,9 +535,8 @@ PyObject* BezierSurfacePy::setWeight(PyObject *args) surf->SetWeight(uindex,vindex,weight); Py_Return; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -573,9 +560,8 @@ PyObject* BezierSurfacePy::setWeightCol(PyObject *args) surf->SetWeightCol(vindex, weights); Py_Return; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -599,9 +585,8 @@ PyObject* BezierSurfacePy::setWeightRow(PyObject *args) surf->SetWeightRow(uindex, weights); Py_Return; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -620,9 +605,8 @@ PyObject* BezierSurfacePy::getWeight(PyObject *args) double w = surf->Weight(uindex,vindex); return Py_BuildValue("d", w); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -646,9 +630,8 @@ PyObject* BezierSurfacePy::getWeights(PyObject *args) } return Py::new_reference_to(weights); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -665,9 +648,8 @@ PyObject* BezierSurfacePy::getResolution(PyObject *args) surf->Resolution(tol,utol,vtol); return Py_BuildValue("(dd)",utol,vtol); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -684,9 +666,8 @@ PyObject* BezierSurfacePy::exchangeUV(PyObject *args) surf->ExchangeUV(); Py_Return; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -703,9 +684,8 @@ PyObject* BezierSurfacePy::uIso(PyObject * args) Handle(Geom_Curve) c = surf->UIso(u); return new BezierCurvePy(new GeomBezierCurve(Handle(Geom_BezierCurve)::DownCast(c))); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -722,9 +702,8 @@ PyObject* BezierSurfacePy::vIso(PyObject * args) Handle(Geom_Curve) c = surf->VIso(v); return new BezierCurvePy(new GeomBezierCurve(Handle(Geom_BezierCurve)::DownCast(c))); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } diff --git a/src/Mod/Part/App/ConePyImp.cpp b/src/Mod/Part/App/ConePyImp.cpp index cc8f973fd6..299644eec5 100644 --- a/src/Mod/Part/App/ConePyImp.cpp +++ b/src/Mod/Part/App/ConePyImp.cpp @@ -167,9 +167,8 @@ PyObject* ConePy::uIso(PyObject * args) this_curv->SetLin(c->Lin()); return new LinePy(line); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -186,9 +185,8 @@ PyObject* ConePy::vIso(PyObject * args) Handle(Geom_Curve) c = cone->VIso(v); return new CirclePy(new GeomCircle(Handle(Geom_Circle)::DownCast(c))); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } diff --git a/src/Mod/Part/App/CylinderPyImp.cpp b/src/Mod/Part/App/CylinderPyImp.cpp index e6cb1dd458..13f171e70a 100644 --- a/src/Mod/Part/App/CylinderPyImp.cpp +++ b/src/Mod/Part/App/CylinderPyImp.cpp @@ -178,9 +178,8 @@ PyObject* CylinderPy::uIso(PyObject * args) PyErr_SetString(PyExc_NotImplementedError, "this type of conical curve is not implemented"); return 0; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -205,9 +204,8 @@ PyObject* CylinderPy::vIso(PyObject * args) PyErr_SetString(PyExc_NotImplementedError, "this type of conical curve is not implemented"); return 0; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } diff --git a/src/Mod/Part/App/FeatureChamfer.cpp b/src/Mod/Part/App/FeatureChamfer.cpp index 538baafdf9..d7b76c6751 100644 --- a/src/Mod/Part/App/FeatureChamfer.cpp +++ b/src/Mod/Part/App/FeatureChamfer.cpp @@ -86,9 +86,8 @@ App::DocumentObjectExecReturn *Chamfer::execute(void) return App::DocumentObject::StdReturn; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - return new App::DocumentObjectExecReturn(e->GetMessageString()); + catch (Standard_Failure& e) { + return new App::DocumentObjectExecReturn(e.GetMessageString()); } } diff --git a/src/Mod/Part/App/FeatureCompound.cpp b/src/Mod/Part/App/FeatureCompound.cpp index 8bbc6db519..08d36b19bf 100644 --- a/src/Mod/Part/App/FeatureCompound.cpp +++ b/src/Mod/Part/App/FeatureCompound.cpp @@ -95,9 +95,8 @@ App::DocumentObjectExecReturn *Compound::execute(void) return App::DocumentObject::StdReturn; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - return new App::DocumentObjectExecReturn(e->GetMessageString()); + catch (Standard_Failure& e) { + return new App::DocumentObjectExecReturn(e.GetMessageString()); } } diff --git a/src/Mod/Part/App/FeatureExtrusion.cpp b/src/Mod/Part/App/FeatureExtrusion.cpp index 6a4c750346..2e3a330495 100644 --- a/src/Mod/Part/App/FeatureExtrusion.cpp +++ b/src/Mod/Part/App/FeatureExtrusion.cpp @@ -338,9 +338,8 @@ App::DocumentObjectExecReturn *Extrusion::execute(void) this->Shape.setValue(result); return App::DocumentObject::StdReturn; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - return new App::DocumentObjectExecReturn(e->GetMessageString()); + catch (Standard_Failure& e) { + return new App::DocumentObjectExecReturn(e.GetMessageString()); } } diff --git a/src/Mod/Part/App/FeatureFillet.cpp b/src/Mod/Part/App/FeatureFillet.cpp index 241599a1a0..19fa4e6e72 100644 --- a/src/Mod/Part/App/FeatureFillet.cpp +++ b/src/Mod/Part/App/FeatureFillet.cpp @@ -85,9 +85,8 @@ App::DocumentObjectExecReturn *Fillet::execute(void) return App::DocumentObject::StdReturn; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - return new App::DocumentObjectExecReturn(e->GetMessageString()); + catch (Standard_Failure& e) { + return new App::DocumentObjectExecReturn(e.GetMessageString()); } catch (...) { return new App::DocumentObjectExecReturn("A fatal error occurred when making fillets"); diff --git a/src/Mod/Part/App/FeatureMirroring.cpp b/src/Mod/Part/App/FeatureMirroring.cpp index 1f5d08b409..5d6a735de3 100644 --- a/src/Mod/Part/App/FeatureMirroring.cpp +++ b/src/Mod/Part/App/FeatureMirroring.cpp @@ -115,8 +115,7 @@ App::DocumentObjectExecReturn *Mirroring::execute(void) this->Shape.setValue(mkTrf.Shape()); return App::DocumentObject::StdReturn; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - return new App::DocumentObjectExecReturn(e->GetMessageString()); + catch (Standard_Failure& e) { + return new App::DocumentObjectExecReturn(e.GetMessageString()); } } diff --git a/src/Mod/Part/App/FeaturePartBox.cpp b/src/Mod/Part/App/FeaturePartBox.cpp index 606dc4da3e..1005b02ab1 100644 --- a/src/Mod/Part/App/FeaturePartBox.cpp +++ b/src/Mod/Part/App/FeaturePartBox.cpp @@ -76,9 +76,8 @@ App::DocumentObjectExecReturn *Box::execute(void) TopoDS_Shape ResultShape = mkBox.Shape(); this->Shape.setValue(ResultShape); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - return new App::DocumentObjectExecReturn(e->GetMessageString()); + catch (Standard_Failure& e) { + return new App::DocumentObjectExecReturn(e.GetMessageString()); } return App::DocumentObject::StdReturn; diff --git a/src/Mod/Part/App/FeaturePartCommon.cpp b/src/Mod/Part/App/FeaturePartCommon.cpp index 8155491364..78a9d8e8f2 100644 --- a/src/Mod/Part/App/FeaturePartCommon.cpp +++ b/src/Mod/Part/App/FeaturePartCommon.cpp @@ -178,9 +178,8 @@ App::DocumentObjectExecReturn *MultiCommon::execute(void) } this->History.setValues(history); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - return new App::DocumentObjectExecReturn(e->GetMessageString()); + catch (Standard_Failure& e) { + return new App::DocumentObjectExecReturn(e.GetMessageString()); } } else { diff --git a/src/Mod/Part/App/FeaturePartFuse.cpp b/src/Mod/Part/App/FeaturePartFuse.cpp index 9b711cc72d..bd276a5f98 100644 --- a/src/Mod/Part/App/FeaturePartFuse.cpp +++ b/src/Mod/Part/App/FeaturePartFuse.cpp @@ -203,9 +203,8 @@ App::DocumentObjectExecReturn *MultiFuse::execute(void) } this->History.setValues(history); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - return new App::DocumentObjectExecReturn(e->GetMessageString()); + catch (Standard_Failure& e) { + return new App::DocumentObjectExecReturn(e.GetMessageString()); } } else { diff --git a/src/Mod/Part/App/FeatureRevolution.cpp b/src/Mod/Part/App/FeatureRevolution.cpp index b624277651..444d0f6a5f 100644 --- a/src/Mod/Part/App/FeatureRevolution.cpp +++ b/src/Mod/Part/App/FeatureRevolution.cpp @@ -200,9 +200,8 @@ App::DocumentObjectExecReturn *Revolution::execute(void) this->Shape.setValue(revolve); return App::DocumentObject::StdReturn; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - return new App::DocumentObjectExecReturn(e->GetMessageString()); + catch (Standard_Failure& e) { + return new App::DocumentObjectExecReturn(e.GetMessageString()); } } diff --git a/src/Mod/Part/App/Geom2d/ArcOfCircle2dPyImp.cpp b/src/Mod/Part/App/Geom2d/ArcOfCircle2dPyImp.cpp index 5ab062450b..13b8f75634 100644 --- a/src/Mod/Part/App/Geom2d/ArcOfCircle2dPyImp.cpp +++ b/src/Mod/Part/App/Geom2d/ArcOfCircle2dPyImp.cpp @@ -73,9 +73,8 @@ int ArcOfCircle2dPy::PyInit(PyObject* args, PyObject* /*kwds*/) getGeom2dArcOfCirclePtr()->setHandle(arc.Value()); return 0; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return -1; } catch (...) { diff --git a/src/Mod/Part/App/Geom2d/ArcOfEllipse2dPyImp.cpp b/src/Mod/Part/App/Geom2d/ArcOfEllipse2dPyImp.cpp index 536a80f799..0e0d544b98 100644 --- a/src/Mod/Part/App/Geom2d/ArcOfEllipse2dPyImp.cpp +++ b/src/Mod/Part/App/Geom2d/ArcOfEllipse2dPyImp.cpp @@ -73,9 +73,9 @@ int ArcOfEllipse2dPy::PyInit(PyObject* args, PyObject* /*kwds*/) getGeom2dArcOfEllipsePtr()->setHandle(arc.Value()); return 0; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return -1; } catch (...) { diff --git a/src/Mod/Part/App/Geom2d/ArcOfHyperbola2dPyImp.cpp b/src/Mod/Part/App/Geom2d/ArcOfHyperbola2dPyImp.cpp index 678a9dc92e..36bb0489ad 100644 --- a/src/Mod/Part/App/Geom2d/ArcOfHyperbola2dPyImp.cpp +++ b/src/Mod/Part/App/Geom2d/ArcOfHyperbola2dPyImp.cpp @@ -73,9 +73,9 @@ int ArcOfHyperbola2dPy::PyInit(PyObject* args, PyObject* /*kwds*/) getGeom2dArcOfHyperbolaPtr()->setHandle(arc.Value()); return 0; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return -1; } catch (...) { diff --git a/src/Mod/Part/App/Geom2d/ArcOfParabola2dPyImp.cpp b/src/Mod/Part/App/Geom2d/ArcOfParabola2dPyImp.cpp index ac65b61099..85cac69faa 100644 --- a/src/Mod/Part/App/Geom2d/ArcOfParabola2dPyImp.cpp +++ b/src/Mod/Part/App/Geom2d/ArcOfParabola2dPyImp.cpp @@ -72,9 +72,9 @@ int ArcOfParabola2dPy::PyInit(PyObject* args, PyObject* /*kwds*/) getGeom2dArcOfParabolaPtr()->setHandle(arc.Value()); return 0; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return -1; } catch (...) { diff --git a/src/Mod/Part/App/Geom2d/BSplineCurve2dPyImp.cpp b/src/Mod/Part/App/Geom2d/BSplineCurve2dPyImp.cpp index 6d47e30251..8858d6df9e 100644 --- a/src/Mod/Part/App/Geom2d/BSplineCurve2dPyImp.cpp +++ b/src/Mod/Part/App/Geom2d/BSplineCurve2dPyImp.cpp @@ -116,9 +116,9 @@ PyObject* BSplineCurve2dPy::increaseDegree(PyObject * args) curve->IncreaseDegree(degree); Py_Return; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -143,9 +143,9 @@ PyObject* BSplineCurve2dPy::increaseMultiplicity(PyObject * args) Py_Return; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -161,9 +161,9 @@ PyObject* BSplineCurve2dPy::incrementMultiplicity(PyObject * args) (getGeometry2dPtr()->handle()); curve->IncrementMultiplicity(start, end, mult); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } @@ -182,9 +182,9 @@ PyObject* BSplineCurve2dPy::insertKnot(PyObject * args) (getGeometry2dPtr()->handle()); curve->InsertKnot(U,M,tol); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } @@ -227,9 +227,9 @@ PyObject* BSplineCurve2dPy::insertKnots(PyObject * args) curve->InsertKnots(k,m,tol,PyObject_IsTrue(add) ? Standard_True : Standard_False); Py_Return; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } @@ -249,9 +249,9 @@ PyObject* BSplineCurve2dPy::removeKnot(PyObject * args) Standard_Boolean ok = curve->RemoveKnot(Index,M,tol); return PyBool_FromLong(ok ? 1 : 0); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -267,9 +267,9 @@ PyObject* BSplineCurve2dPy::segment(PyObject * args) curve->Segment(u1,u2); Py_Return; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -325,9 +325,9 @@ PyObject* BSplineCurve2dPy::setKnots(PyObject * args) curve->SetKnots(k); Py_Return; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -347,9 +347,9 @@ PyObject* BSplineCurve2dPy::getKnots(PyObject * args) } return Py::new_reference_to(knots); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -372,9 +372,9 @@ PyObject* BSplineCurve2dPy::setPole(PyObject * args) curve->SetPole(index,pnt,weight); Py_Return; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -398,9 +398,9 @@ PyObject* BSplineCurve2dPy::getPole(PyObject * args) arg.setItem(1, Py::Float(pnt.Y())); return Py::new_reference_to(method.apply(arg)); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -428,9 +428,9 @@ PyObject* BSplineCurve2dPy::getPoles(PyObject * args) } return Py::new_reference_to(poles); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -459,9 +459,9 @@ PyObject* BSplineCurve2dPy::getPolesAndWeights(PyObject * args) } return Py::new_reference_to(poles); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -478,9 +478,9 @@ PyObject* BSplineCurve2dPy::setWeight(PyObject * args) curve->SetWeight(index,weight); Py_Return; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -498,9 +498,9 @@ PyObject* BSplineCurve2dPy::getWeight(PyObject * args) double weight = curve->Weight(index); return Py_BuildValue("d", weight); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -520,9 +520,9 @@ PyObject* BSplineCurve2dPy::getWeights(PyObject * args) } return Py::new_reference_to(weights); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -539,9 +539,9 @@ PyObject* BSplineCurve2dPy::getResolution(PyObject * args) curve->Resolution(tol,utol); return Py_BuildValue("d",utol); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -561,9 +561,9 @@ PyObject* BSplineCurve2dPy::movePoint(PyObject * args) curve->MovePoint(U, gp_Pnt2d(p.x,p.y), index1, index2, first, last); return Py_BuildValue("(ii)",first, last); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -578,9 +578,9 @@ PyObject* BSplineCurve2dPy::setNotPeriodic(PyObject * args) curve->SetNotPeriodic(); Py_Return; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -595,9 +595,9 @@ PyObject* BSplineCurve2dPy::setPeriodic(PyObject * args) curve->SetPeriodic(); Py_Return; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -613,9 +613,9 @@ PyObject* BSplineCurve2dPy::setOrigin(PyObject * args) curve->SetOrigin(index); Py_Return; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -631,9 +631,9 @@ PyObject* BSplineCurve2dPy::getMultiplicity(PyObject * args) int mult = curve->Multiplicity(index); return Py_BuildValue("i", mult); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -657,9 +657,9 @@ PyObject* BSplineCurve2dPy::getMultiplicities(PyObject * args) } return Py::new_reference_to(mults); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -784,9 +784,9 @@ PyObject* BSplineCurve2dPy::toBiArcs(PyObject * args) return Py::new_reference_to(list); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -905,9 +905,9 @@ PyObject* BSplineCurve2dPy::approximate(PyObject *args, PyObject *kwds) return 0; // goes to the catch block } } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -1072,10 +1072,10 @@ PyObject* BSplineCurve2dPy::interpolate(PyObject *args, PyObject *kwds) return 0; // goes to the catch block } } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - std::string err = e->GetMessageString(); - if (err.empty()) err = e->DynamicType()->Name(); + catch (Standard_Failure& e) { + + std::string err = e.GetMessageString(); + if (err.empty()) err = e.DynamicType()->Name(); PyErr_SetString(PartExceptionOCCError, err.c_str()); return 0; } @@ -1152,9 +1152,9 @@ PyObject* BSplineCurve2dPy::buildFromPoles(PyObject *args) } } } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -1294,9 +1294,8 @@ PyObject* BSplineCurve2dPy::buildFromPolesMultsKnots(PyObject *args, PyObject *k return 0; // goes to the catch block } } - catch (const Standard_Failure & ) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - Standard_CString msg = e->GetMessageString(); + catch (const Standard_Failure& e) { + Standard_CString msg = e.GetMessageString(); PyErr_SetString(PartExceptionOCCError, msg ? msg : ""); return 0; } @@ -1348,10 +1347,9 @@ PyObject* BSplineCurve2dPy::makeC1Continuous(PyObject *args) spline->makeC1Continuous(tol); Py_Return; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - std::string err = e->GetMessageString(); - if (err.empty()) err = e->DynamicType()->Name(); + catch (Standard_Failure& e) { + std::string err = e.GetMessageString(); + if (err.empty()) err = e.DynamicType()->Name(); PyErr_SetString(PartExceptionOCCError, err.c_str()); return 0; } diff --git a/src/Mod/Part/App/Geom2d/BezierCurve2dPyImp.cpp b/src/Mod/Part/App/Geom2d/BezierCurve2dPyImp.cpp index ee896c34c6..1cd5702e55 100644 --- a/src/Mod/Part/App/Geom2d/BezierCurve2dPyImp.cpp +++ b/src/Mod/Part/App/Geom2d/BezierCurve2dPyImp.cpp @@ -112,9 +112,9 @@ PyObject* BezierCurve2dPy::insertPoleAfter(PyObject * args) curve->InsertPoleAfter(index,pnt,weight); Py_Return; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -134,9 +134,9 @@ PyObject* BezierCurve2dPy::insertPoleBefore(PyObject * args) curve->InsertPoleBefore(index,pnt,weight); Py_Return; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -152,9 +152,9 @@ PyObject* BezierCurve2dPy::removePole(PyObject * args) curve->RemovePole(index); Py_Return; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -170,9 +170,9 @@ PyObject* BezierCurve2dPy::segment(PyObject * args) curve->Segment(u1,u2); Py_Return; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -195,9 +195,9 @@ PyObject* BezierCurve2dPy::setPole(PyObject * args) curve->SetPole(index,pnt,weight); Py_Return; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -221,9 +221,9 @@ PyObject* BezierCurve2dPy::getPole(PyObject * args) arg.setItem(1, Py::Float(pnt.Y())); return Py::new_reference_to(method.apply(arg)); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -251,9 +251,9 @@ PyObject* BezierCurve2dPy::getPoles(PyObject * args) } return Py::new_reference_to(poles); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -276,9 +276,9 @@ PyObject* BezierCurve2dPy::setPoles(PyObject * args) this->getGeom2dBezierCurvePtr()->setHandle(bezier); Py_Return; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -295,9 +295,9 @@ PyObject* BezierCurve2dPy::setWeight(PyObject * args) curve->SetWeight(index,weight); Py_Return; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -315,9 +315,9 @@ PyObject* BezierCurve2dPy::getWeight(PyObject * args) double weight = curve->Weight(index); return Py_BuildValue("d", weight); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -337,9 +337,9 @@ PyObject* BezierCurve2dPy::getWeights(PyObject * args) } return Py::new_reference_to(weights); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -356,9 +356,9 @@ PyObject* BezierCurve2dPy::getResolution(PyObject* args) curve->Resolution(tol,utol); return Py_BuildValue("d",utol); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } diff --git a/src/Mod/Part/App/Geom2d/Curve2dPyImp.cpp b/src/Mod/Part/App/Geom2d/Curve2dPyImp.cpp index 9cf0df749e..cbc8a77eb4 100644 --- a/src/Mod/Part/App/Geom2d/Curve2dPyImp.cpp +++ b/src/Mod/Part/App/Geom2d/Curve2dPyImp.cpp @@ -106,9 +106,9 @@ PyObject* Curve2dPy::reverse(PyObject * args) curve->Reverse(); Py_Return; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -193,9 +193,9 @@ PyObject* Curve2dPy::toShape(PyObject *args) TopoDS_Shape edge = mkBuilder.Shape(); return Py::new_reference_to(shape2pyshape(edge)); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -210,9 +210,9 @@ PyObject* Curve2dPy::toShape(PyObject *args) TopoDS_Shape edge = mkBuilder.Shape(); return Py::new_reference_to(shape2pyshape(edge)); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -231,9 +231,9 @@ PyObject* Curve2dPy::toShape(PyObject *args) return Py::new_reference_to(shape2pyshape(edge)); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -251,9 +251,9 @@ PyObject* Curve2dPy::toShape(PyObject *args) return Py::new_reference_to(shape2pyshape(edge)); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -271,9 +271,9 @@ PyObject* Curve2dPy::toShape(PyObject *args) return Py::new_reference_to(shape2pyshape(edge)); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -291,9 +291,9 @@ PyObject* Curve2dPy::toShape(PyObject *args) return Py::new_reference_to(shape2pyshape(edge)); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -515,9 +515,9 @@ PyObject* Curve2dPy::length(PyObject *args) return PyFloat_FromDouble(len); } } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } @@ -541,9 +541,9 @@ PyObject* Curve2dPy::parameterAtDistance(PyObject *args) return PyFloat_FromDouble(parm); } } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } @@ -570,9 +570,9 @@ PyObject* Curve2dPy::value(PyObject *args) return Py::new_reference_to(method.apply(arg)); } } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } @@ -603,9 +603,9 @@ PyObject* Curve2dPy::tangent(PyObject *args) return Py::new_reference_to(method.apply(arg)); } } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } @@ -634,9 +634,9 @@ PyObject* Curve2dPy::normal(PyObject *args) return Py::new_reference_to(method.apply(arg)); } } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } @@ -658,9 +658,9 @@ PyObject* Curve2dPy::curvature(PyObject *args) return Py::new_reference_to(Py::Float(C)); } } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } @@ -689,9 +689,9 @@ PyObject* Curve2dPy::centerOfCurvature(PyObject *args) return Py::new_reference_to(method.apply(arg)); } } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } @@ -715,9 +715,9 @@ PyObject* Curve2dPy::parameter(PyObject *args) return Py::new_reference_to(Py::Float(val)); } } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } @@ -743,9 +743,9 @@ PyObject* Curve2dPy::toBSpline(PyObject * args) return new BSplineCurve2dPy(new Geom2dBSplineCurve(spline)); } } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } @@ -797,9 +797,9 @@ PyObject* Curve2dPy::approximateBSpline(PyObject *args) return 0; } } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -910,9 +910,9 @@ PyObject* Curve2dPy::intersectCC(PyObject *args) return Py::new_reference_to(points); } } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PyExc_RuntimeError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PyExc_RuntimeError, e.GetMessageString()); return 0; } diff --git a/src/Mod/Part/App/Geom2d/Line2dPyImp.cpp b/src/Mod/Part/App/Geom2d/Line2dPyImp.cpp index 63106039be..476fd3445e 100644 --- a/src/Mod/Part/App/Geom2d/Line2dPyImp.cpp +++ b/src/Mod/Part/App/Geom2d/Line2dPyImp.cpp @@ -103,9 +103,9 @@ int Line2dPy::PyInit(PyObject* args, PyObject* /*kwd*/) this_line->SetLin2d(that_line->Lin2d()); return 0; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return -1; } catch (...) { @@ -170,9 +170,9 @@ void Line2dPy::setLocation(Py::Object arg) Handle(Geom2d_Line) that_line = ms.Value(); this_line->SetLin2d(that_line->Lin2d()); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Py::Exception(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Py::Exception(e.GetMessageString()); } } @@ -225,9 +225,9 @@ void Line2dPy::setDirection(Py::Object arg) Handle(Geom2d_Line) that_line = ms.Value(); this_line->SetLin2d(that_line->Lin2d()); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Py::Exception(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Py::Exception(e.GetMessageString()); } } diff --git a/src/Mod/Part/App/Geom2d/Line2dSegmentPyImp.cpp b/src/Mod/Part/App/Geom2d/Line2dSegmentPyImp.cpp index a2e05a258e..2c3b8dde7f 100644 --- a/src/Mod/Part/App/Geom2d/Line2dSegmentPyImp.cpp +++ b/src/Mod/Part/App/Geom2d/Line2dSegmentPyImp.cpp @@ -156,9 +156,9 @@ int Line2dSegmentPy::PyInit(PyObject* args, PyObject* /*kwd*/) this_curv->SetTrim(that_curv->FirstParameter(), that_curv->LastParameter()); return 0; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return -1; } catch (...) { @@ -187,9 +187,9 @@ PyObject* Line2dSegmentPy::setParameterRange(PyObject *args) (this->getGeom2dLineSegmentPtr()->handle()); this_curve->SetTrim(first, last); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return NULL; } @@ -251,9 +251,9 @@ void Line2dSegmentPy::setStartPoint(Py::Object arg) this_line->SetLin2d(that_line->Lin2d()); this_curv->SetTrim(that_curv->FirstParameter(), that_curv->LastParameter()); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Py::Exception(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Py::Exception(e.GetMessageString()); } } @@ -312,9 +312,9 @@ void Line2dSegmentPy::setEndPoint(Py::Object arg) this_line->SetLin2d(that_line->Lin2d()); this_curv->SetTrim(that_curv->FirstParameter(), that_curv->LastParameter()); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Py::Exception(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Py::Exception(e.GetMessageString()); } } diff --git a/src/Mod/Part/App/Geom2d/OffsetCurve2dPyImp.cpp b/src/Mod/Part/App/Geom2d/OffsetCurve2dPyImp.cpp index b241e07986..e852a2a5fb 100644 --- a/src/Mod/Part/App/Geom2d/OffsetCurve2dPyImp.cpp +++ b/src/Mod/Part/App/Geom2d/OffsetCurve2dPyImp.cpp @@ -70,9 +70,9 @@ int OffsetCurve2dPy::PyInit(PyObject* args, PyObject* /*kwd*/) getGeom2dOffsetCurvePtr()->setHandle(curve2); return 0; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return -1; } } @@ -121,9 +121,9 @@ void OffsetCurve2dPy::setBasisCurve(Py::Object arg) try { curve2->SetBasisCurve(curve); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Py::Exception(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Py::Exception(e.GetMessageString()); } } } diff --git a/src/Mod/Part/App/Geometry.cpp b/src/Mod/Part/App/Geometry.cpp index 561d3a78da..707f9cc602 100644 --- a/src/Mod/Part/App/Geometry.cpp +++ b/src/Mod/Part/App/Geometry.cpp @@ -434,9 +434,9 @@ bool GeomCurve::normalAt(double u, Base::Vector3d& dir) const return true; } } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Base::RuntimeError(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Base::RuntimeError(e.GetMessageString()); } return false; @@ -453,9 +453,9 @@ bool GeomCurve::closestParameter(const Base::Vector3d& point, double &u) const return true; } } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Base::RuntimeError(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Base::RuntimeError(e.GetMessageString()); } return false; @@ -476,9 +476,9 @@ bool GeomCurve::closestParameterToBasicCurve(const Base::Vector3d& point, double return true; } } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Base::RuntimeError(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Base::RuntimeError(e.GetMessageString()); } return false; @@ -496,9 +496,9 @@ double GeomCurve::getFirstParameter() const // pending check for RealFirst RealLast in case of infinite curve return c->FirstParameter(); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Base::RuntimeError(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Base::RuntimeError(e.GetMessageString()); } } @@ -511,9 +511,9 @@ double GeomCurve::getLastParameter() const // pending check for RealFirst RealLast in case of infinite curve return c->LastParameter(); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Base::RuntimeError(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Base::RuntimeError(e.GetMessageString()); } } @@ -525,9 +525,9 @@ double GeomCurve::curvatureAt(double u) const GeomLProp_CLProps prop(c,u,2,Precision::Confusion()); return prop.Curvature(); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Base::RuntimeError(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Base::RuntimeError(e.GetMessageString()); } } @@ -540,9 +540,9 @@ double GeomCurve::length(double u, double v) const GeomAdaptor_Curve adaptor(c); return GCPnts_AbscissaPoint::Length(adaptor,u,v,Precision::Confusion()); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Base::RuntimeError(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Base::RuntimeError(e.GetMessageString()); } } @@ -553,9 +553,9 @@ void GeomCurve::reverse(void) try { c->Reverse(); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Base::RuntimeError(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Base::RuntimeError(e.GetMessageString()); } } @@ -742,9 +742,9 @@ void GeomBezierCurve::Restore(Base::XMLReader& reader) else throw Base::RuntimeError("BezierCurve restore failed"); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Base::RuntimeError(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Base::RuntimeError(e.GetMessageString()); } } @@ -849,9 +849,9 @@ void GeomBSplineCurve::setPole(int index, const Base::Vector3d& pole, double wei else myCurve->SetPole(index,pnt,weight); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Base::RuntimeError(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Base::RuntimeError(e.GetMessageString()); } } @@ -913,9 +913,9 @@ void GeomBSplineCurve::setWeights(const std::vector& weights) myCurve->SetWeight(index, *it); } } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Base::RuntimeError(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Base::RuntimeError(e.GetMessageString()); } } @@ -927,9 +927,9 @@ void GeomBSplineCurve::setKnot(int index, const double val, int mult) else myCurve->SetKnot(index, val, mult); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Base::RuntimeError(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Base::RuntimeError(e.GetMessageString()); } } @@ -987,9 +987,9 @@ int GeomBSplineCurve::getMultiplicity(int index) const try { return myCurve->Multiplicity(index); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Base::RuntimeError(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Base::RuntimeError(e.GetMessageString()); } } @@ -1108,9 +1108,9 @@ void GeomBSplineCurve::increaseDegree(double degree) curve->IncreaseDegree(degree); return; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Base::RuntimeError(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Base::RuntimeError(e.GetMessageString()); } } @@ -1121,9 +1121,9 @@ void GeomBSplineCurve::increaseMultiplicity(int index, int multiplicity) curve->IncreaseMultiplicity(index, multiplicity); return; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Base::RuntimeError(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Base::RuntimeError(e.GetMessageString()); } } @@ -1133,9 +1133,9 @@ bool GeomBSplineCurve::removeKnot(int index, int multiplicity, double tolerance) Handle(Geom_BSplineCurve) curve = Handle(Geom_BSplineCurve)::DownCast(this->handle()); return curve->RemoveKnot(index, multiplicity, tolerance) == Standard_True; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Base::RuntimeError(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Base::RuntimeError(e.GetMessageString()); } } @@ -1250,9 +1250,9 @@ void GeomBSplineCurve::Restore(Base::XMLReader& reader) else throw Base::RuntimeError("BSpline restore failed"); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Base::RuntimeError(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Base::RuntimeError(e.GetMessageString()); } } @@ -1290,9 +1290,9 @@ void GeomConic::setLocation(const Base::Vector3d& Center) try { conic->SetLocation(p1); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Base::RuntimeError(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Base::RuntimeError(e.GetMessageString()); } } @@ -1312,9 +1312,9 @@ void GeomConic::setCenter(const Base::Vector3d& Center) try { conic->SetLocation(p1); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Base::RuntimeError(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Base::RuntimeError(e.GetMessageString()); } } @@ -1361,9 +1361,9 @@ void GeomConic::setAngleXU(double angle) xdirref.Rotate(normaxis,angle); conic->SetPosition(xdirref); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Base::RuntimeError(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Base::RuntimeError(e.GetMessageString()); } } @@ -1453,9 +1453,9 @@ void GeomArcOfConic::setCenter(const Base::Vector3d& Center) try { conic->SetLocation(p1); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Base::RuntimeError(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Base::RuntimeError(e.GetMessageString()); } } @@ -1468,9 +1468,9 @@ void GeomArcOfConic::setLocation(const Base::Vector3d& Center) try { conic->SetLocation(p1); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Base::RuntimeError(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Base::RuntimeError(e.GetMessageString()); } } @@ -1530,9 +1530,9 @@ void GeomArcOfConic::setAngleXU(double angle) xdirref.Rotate(normaxis,angle); conic->SetPosition(xdirref); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Base::RuntimeError(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Base::RuntimeError(e.GetMessageString()); } } @@ -1576,9 +1576,9 @@ void GeomArcOfConic::setXAxisDir(const Base::Vector3d& newdir) pos.SetXDirection(gp_Dir(newdir.x, newdir.y, newdir.z)); c->SetPosition(pos); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Base::RuntimeError(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Base::RuntimeError(e.GetMessageString()); } } @@ -1681,9 +1681,9 @@ void GeomCircle::setRadius(double Radius) c.SetRadius(Radius); circle->SetCirc(c); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Base::RuntimeError(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Base::RuntimeError(e.GetMessageString()); } } @@ -1741,9 +1741,9 @@ void GeomCircle::Restore(Base::XMLReader& reader) this->myCurve = mc.Value(); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Base::RuntimeError(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Base::RuntimeError(e.GetMessageString()); } } @@ -1820,9 +1820,9 @@ void GeomArcOfCircle::setRadius(double Radius) c.SetRadius(Radius); circle->SetCirc(c); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Base::RuntimeError(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Base::RuntimeError(e.GetMessageString()); } } @@ -1893,9 +1893,9 @@ void GeomArcOfCircle::setRange(double u, double v, bool emulateCCWXY) curve->SetTrim(u, v); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Base::RuntimeError(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Base::RuntimeError(e.GetMessageString()); } } @@ -1967,9 +1967,9 @@ void GeomArcOfCircle::Restore(Base::XMLReader &reader) circle->SetCirc(tmpcircle->Circ()); this->myCurve->SetTrim(tmpcurve->FirstParameter(), tmpcurve->LastParameter()); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Base::RuntimeError(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Base::RuntimeError(e.GetMessageString()); } } @@ -2075,9 +2075,9 @@ void GeomEllipse::setMajorRadius(double Radius) try { ellipse->SetMajorRadius(Radius); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Base::RuntimeError(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Base::RuntimeError(e.GetMessageString()); } } @@ -2094,9 +2094,9 @@ void GeomEllipse::setMinorRadius(double Radius) try { ellipse->SetMinorRadius(Radius); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Base::RuntimeError(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Base::RuntimeError(e.GetMessageString()); } } @@ -2132,9 +2132,9 @@ void GeomEllipse::setMajorAxisDir(Base::Vector3d newdir) pos.SetXDirection(gp_Dir(newdir.x, newdir.y, newdir.z));//OCC should keep the old main Direction (Z), and change YDirection to accommodate the new XDirection. myCurve->SetPosition(pos); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Base::RuntimeError(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Base::RuntimeError(e.GetMessageString()); } } @@ -2214,9 +2214,9 @@ void GeomEllipse::Restore(Base::XMLReader& reader) this->myCurve = mc.Value(); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Base::RuntimeError(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Base::RuntimeError(e.GetMessageString()); } } @@ -2290,9 +2290,9 @@ void GeomArcOfEllipse::setMajorRadius(double Radius) try { ellipse->SetMajorRadius(Radius); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Base::RuntimeError(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Base::RuntimeError(e.GetMessageString()); } } @@ -2309,9 +2309,9 @@ void GeomArcOfEllipse::setMinorRadius(double Radius) try { ellipse->SetMinorRadius(Radius); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Base::RuntimeError(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Base::RuntimeError(e.GetMessageString()); } } @@ -2351,9 +2351,9 @@ void GeomArcOfEllipse::setMajorAxisDir(Base::Vector3d newdir) pos.SetXDirection(gp_Dir(newdir.x, newdir.y, newdir.z));//OCC should keep the old main Direction (Z), and change YDirection to accommodate the new XDirection. c->SetPosition(pos); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Base::RuntimeError(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Base::RuntimeError(e.GetMessageString()); } } @@ -2398,9 +2398,9 @@ void GeomArcOfEllipse::setRange(double u, double v, bool emulateCCWXY) } myCurve->SetTrim(u, v); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Base::RuntimeError(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Base::RuntimeError(e.GetMessageString()); } } @@ -2491,9 +2491,9 @@ void GeomArcOfEllipse::Restore(Base::XMLReader &reader) ellipse->SetElips(tmpellipse->Elips()); this->myCurve->SetTrim(tmpcurve->FirstParameter(), tmpcurve->LastParameter()); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Base::RuntimeError(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Base::RuntimeError(e.GetMessageString()); } } @@ -2557,9 +2557,9 @@ void GeomHyperbola::setMajorRadius(double Radius) try { h->SetMajorRadius(Radius); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Base::RuntimeError(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Base::RuntimeError(e.GetMessageString()); } } @@ -2576,9 +2576,9 @@ void GeomHyperbola::setMinorRadius(double Radius) try { h->SetMinorRadius(Radius); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Base::RuntimeError(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Base::RuntimeError(e.GetMessageString()); } } @@ -2652,9 +2652,9 @@ void GeomHyperbola::Restore(Base::XMLReader& reader) this->myCurve = mc.Value(); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Base::RuntimeError(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Base::RuntimeError(e.GetMessageString()); } } @@ -2728,9 +2728,9 @@ void GeomArcOfHyperbola::setMajorRadius(double Radius) try { h->SetMajorRadius(Radius); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Base::RuntimeError(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Base::RuntimeError(e.GetMessageString()); } } @@ -2747,9 +2747,9 @@ void GeomArcOfHyperbola::setMinorRadius(double Radius) try { h->SetMinorRadius(Radius); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Base::RuntimeError(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Base::RuntimeError(e.GetMessageString()); } } @@ -2790,9 +2790,9 @@ void GeomArcOfHyperbola::setMajorAxisDir(Base::Vector3d newdir) pos.SetXDirection(gp_Dir(newdir.x, newdir.y, newdir.z));//OCC should keep the old main Direction (Z), and change YDirection to accommodate the new XDirection. c->SetPosition(pos); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Base::RuntimeError(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Base::RuntimeError(e.GetMessageString()); } } @@ -2807,9 +2807,9 @@ void GeomArcOfHyperbola::getRange(double& u, double& v, bool emulateCCWXY) const } } } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Base::RuntimeError(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Base::RuntimeError(e.GetMessageString()); } u = myCurve->FirstParameter(); @@ -2829,9 +2829,9 @@ void GeomArcOfHyperbola::setRange(double u, double v, bool emulateCCWXY) } } } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Base::RuntimeError(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Base::RuntimeError(e.GetMessageString()); } } @@ -2921,9 +2921,9 @@ void GeomArcOfHyperbola::Restore(Base::XMLReader &reader) hyperbola->SetHypr(tmphyperbola->Hypr()); this->myCurve->SetTrim(tmpcurve->FirstParameter(), tmpcurve->LastParameter()); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Base::RuntimeError(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Base::RuntimeError(e.GetMessageString()); } } @@ -2987,9 +2987,9 @@ void GeomParabola::setFocal(double length) try { p->SetFocal(length); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Base::RuntimeError(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Base::RuntimeError(e.GetMessageString()); } } @@ -3061,9 +3061,9 @@ void GeomParabola::Restore(Base::XMLReader& reader) this->myCurve = new Geom_Parabola(mc.Value()); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Base::RuntimeError(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Base::RuntimeError(e.GetMessageString()); } } @@ -3137,9 +3137,9 @@ void GeomArcOfParabola::setFocal(double length) try { p->SetFocal(length); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Base::RuntimeError(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Base::RuntimeError(e.GetMessageString()); } } @@ -3162,9 +3162,9 @@ void GeomArcOfParabola::getRange(double& u, double& v, bool emulateCCWXY) const } } } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Base::RuntimeError(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Base::RuntimeError(e.GetMessageString()); } u = myCurve->FirstParameter(); @@ -3183,9 +3183,9 @@ void GeomArcOfParabola::setRange(double u, double v, bool emulateCCWXY) } } } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Base::RuntimeError(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Base::RuntimeError(e.GetMessageString()); } } @@ -3273,9 +3273,9 @@ void GeomArcOfParabola::Restore(Base::XMLReader &reader) parabola->SetParab(tmpparabola->Parab()); this->myCurve->SetTrim(tmpcurve->FirstParameter(), tmpcurve->LastParameter()); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Base::RuntimeError(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Base::RuntimeError(e.GetMessageString()); } } @@ -3479,9 +3479,9 @@ void GeomLineSegment::setPoints(const Base::Vector3d& Start, const Base::Vector3 this_line->SetLin(that_line->Lin()); this_curv->SetTrim(that_curv->FirstParameter(), that_curv->LastParameter()); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Base::RuntimeError(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Base::RuntimeError(e.GetMessageString()); } } diff --git a/src/Mod/Part/App/Geometry2d.cpp b/src/Mod/Part/App/Geometry2d.cpp index a29a87ff42..58af9bfc46 100644 --- a/src/Mod/Part/App/Geometry2d.cpp +++ b/src/Mod/Part/App/Geometry2d.cpp @@ -294,9 +294,9 @@ bool Geom2dCurve::closestParameter(const Base::Vector2d& point, double &u) const return true; } } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - std::cout << e->GetMessageString() << std::endl; + catch (Standard_Failure& e) { + + std::cout << e.GetMessageString() << std::endl; return false; } @@ -318,9 +318,9 @@ bool Geom2dCurve::closestParameterToBasicCurve(const Base::Vector2d& point, doub return true; } } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - std::cout << e->GetMessageString() << std::endl; + catch (Standard_Failure& e) { + + std::cout << e.GetMessageString() << std::endl; return false; } @@ -450,9 +450,9 @@ void Geom2dBSplineCurve::setPole(int index, const Base::Vector2d& pole, double w else myCurve->SetPole(index+1,pnt,weight); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - std::cout << e->GetMessageString() << std::endl; + catch (Standard_Failure& e) { + + std::cout << e.GetMessageString() << std::endl; } } @@ -621,9 +621,9 @@ void Geom2dConic::setLocation(const Base::Vector2d& Center) try { conic->SetLocation(p1); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Base::Exception(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Base::Exception(e.GetMessageString()); } } @@ -701,9 +701,9 @@ void Geom2dArcOfConic::setLocation(const Base::Vector2d& Center) try { conic->SetLocation(p1); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Base::Exception(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Base::Exception(e.GetMessageString()); } } @@ -765,9 +765,9 @@ void Geom2dArcOfConic::setRange(double u, double v) Handle(Geom2d_TrimmedCurve) curve = Handle(Geom2d_TrimmedCurve)::DownCast(handle()); curve->SetTrim(u, v); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Base::Exception(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Base::Exception(e.GetMessageString()); } } @@ -853,9 +853,9 @@ void Geom2dCircle::setRadius(double Radius) c.SetRadius(Radius); circle->SetCirc2d(c); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Base::Exception(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Base::Exception(e.GetMessageString()); } } @@ -902,9 +902,9 @@ void Geom2dCircle::Restore(Base::XMLReader& reader) this->myCurve = mc.Value(); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Base::Exception(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Base::Exception(e.GetMessageString()); } } @@ -967,9 +967,9 @@ void Geom2dArcOfCircle::setRadius(double Radius) c.SetRadius(Radius); circle->SetCirc2d(c); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Base::Exception(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Base::Exception(e.GetMessageString()); } } @@ -1027,9 +1027,9 @@ void Geom2dArcOfCircle::Restore(Base::XMLReader &reader) circle->SetCirc2d(tmpcircle->Circ2d()); this->myCurve->SetTrim(tmpcurve->FirstParameter(), tmpcurve->LastParameter()); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Base::Exception(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Base::Exception(e.GetMessageString()); } } @@ -1081,9 +1081,9 @@ void Geom2dEllipse::setMajorRadius(double Radius) try { ellipse->SetMajorRadius(Radius); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Base::Exception(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Base::Exception(e.GetMessageString()); } } @@ -1100,9 +1100,9 @@ void Geom2dEllipse::setMinorRadius(double Radius) try { ellipse->SetMinorRadius(Radius); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Base::Exception(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Base::Exception(e.GetMessageString()); } } @@ -1136,9 +1136,9 @@ void Geom2dEllipse::setMajorAxisDir(Base::Vector2d newdir) e.SetAxis(pos); myCurve->SetElips2d(e); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Base::Exception(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Base::Exception(e.GetMessageString()); } } @@ -1186,9 +1186,9 @@ void Geom2dEllipse::Restore(Base::XMLReader& reader) this->myCurve = mc.Value(); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Base::Exception(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Base::Exception(e.GetMessageString()); } } @@ -1254,9 +1254,9 @@ void Geom2dArcOfEllipse::setMajorRadius(double Radius) try { ellipse->SetMajorRadius(Radius); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Base::Exception(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Base::Exception(e.GetMessageString()); } } @@ -1273,9 +1273,9 @@ void Geom2dArcOfEllipse::setMinorRadius(double Radius) try { ellipse->SetMinorRadius(Radius); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Base::Exception(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Base::Exception(e.GetMessageString()); } } @@ -1313,9 +1313,9 @@ void Geom2dArcOfEllipse::setMajorAxisDir(Base::Vector2d newdir) e.SetAxis(pos); c->SetElips2d(e); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Base::Exception(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Base::Exception(e.GetMessageString()); } } @@ -1376,9 +1376,9 @@ void Geom2dArcOfEllipse::Restore(Base::XMLReader &reader) ellipse->SetElips2d(tmpellipse->Elips2d()); this->myCurve->SetTrim(tmpcurve->FirstParameter(), tmpcurve->LastParameter()); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Base::Exception(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Base::Exception(e.GetMessageString()); } } @@ -1430,9 +1430,9 @@ void Geom2dHyperbola::setMajorRadius(double Radius) try { h->SetMajorRadius(Radius); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Base::Exception(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Base::Exception(e.GetMessageString()); } } @@ -1449,9 +1449,9 @@ void Geom2dHyperbola::setMinorRadius(double Radius) try { h->SetMinorRadius(Radius); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Base::Exception(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Base::Exception(e.GetMessageString()); } } @@ -1499,9 +1499,9 @@ void Geom2dHyperbola::Restore(Base::XMLReader& reader) this->myCurve = mc.Value(); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Base::Exception(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Base::Exception(e.GetMessageString()); } } @@ -1562,9 +1562,9 @@ void Geom2dArcOfHyperbola::setMajorRadius(double Radius) try { h->SetMajorRadius(Radius); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Base::Exception(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Base::Exception(e.GetMessageString()); } } @@ -1581,9 +1581,9 @@ void Geom2dArcOfHyperbola::setMinorRadius(double Radius) try { h->SetMinorRadius(Radius); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Base::Exception(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Base::Exception(e.GetMessageString()); } } @@ -1644,9 +1644,9 @@ void Geom2dArcOfHyperbola::Restore(Base::XMLReader &reader) hyperbola->SetHypr2d(tmphyperbola->Hypr2d()); this->myCurve->SetTrim(tmpcurve->FirstParameter(), tmpcurve->LastParameter()); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Base::Exception(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Base::Exception(e.GetMessageString()); } } @@ -1698,9 +1698,9 @@ void Geom2dParabola::setFocal(double length) try { p->SetFocal(length); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Base::Exception(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Base::Exception(e.GetMessageString()); } } @@ -1747,9 +1747,9 @@ void Geom2dParabola::Restore(Base::XMLReader& reader) this->myCurve = mc.Value(); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Base::Exception(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Base::Exception(e.GetMessageString()); } } @@ -1810,9 +1810,9 @@ void Geom2dArcOfParabola::setFocal(double length) try { p->SetFocal(length); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Base::Exception(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Base::Exception(e.GetMessageString()); } } @@ -1871,9 +1871,9 @@ void Geom2dArcOfParabola::Restore(Base::XMLReader &reader) parabola->SetParab2d(tmpparabola->Parab2d()); this->myCurve->SetTrim(tmpcurve->FirstParameter(), tmpcurve->LastParameter()); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Base::Exception(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Base::Exception(e.GetMessageString()); } } @@ -1981,9 +1981,9 @@ void Geom2dLine::Restore(Base::XMLReader &reader) this->myCurve = mc.Value(); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Base::Exception(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Base::Exception(e.GetMessageString()); } } @@ -2065,9 +2065,9 @@ void Geom2dLineSegment::setPoints(const Base::Vector2d& Start, const Base::Vecto this_line->SetLin2d(that_line->Lin2d()); this_curv->SetTrim(that_curv->FirstParameter(), that_curv->LastParameter()); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Base::Exception(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Base::Exception(e.GetMessageString()); } } @@ -2118,9 +2118,9 @@ void Geom2dLineSegment::Restore(Base::XMLReader &reader) this->myCurve = mc.Value(); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Base::Exception(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Base::Exception(e.GetMessageString()); } } diff --git a/src/Mod/Part/App/GeometryCurvePyImp.cpp b/src/Mod/Part/App/GeometryCurvePyImp.cpp index 21a728109d..899e1fd288 100644 --- a/src/Mod/Part/App/GeometryCurvePyImp.cpp +++ b/src/Mod/Part/App/GeometryCurvePyImp.cpp @@ -115,9 +115,9 @@ PyObject* GeometryCurvePy::toShape(PyObject *args) return new TopoShapeEdgePy(new TopoShape(sh)); } } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } @@ -321,9 +321,9 @@ PyObject* GeometryCurvePy::length(PyObject *args) return PyFloat_FromDouble(len); } } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } @@ -347,9 +347,9 @@ PyObject* GeometryCurvePy::parameterAtDistance(PyObject *args) return PyFloat_FromDouble(parm); } } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } @@ -370,9 +370,9 @@ PyObject* GeometryCurvePy::value(PyObject *args) return new Base::VectorPy(Base::Vector3d(p.X(),p.Y(),p.Z())); } } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } @@ -400,9 +400,9 @@ PyObject* GeometryCurvePy::tangent(PyObject *args) return Py::new_reference_to(tuple); } } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } @@ -425,9 +425,9 @@ PyObject* GeometryCurvePy::normal(PyObject *args) return new Base::VectorPy(new Base::Vector3d(dir.X(),dir.Y(),dir.Z())); } } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } @@ -449,9 +449,9 @@ PyObject* GeometryCurvePy::curvature(PyObject *args) return Py::new_reference_to(Py::Float(C)); } } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } @@ -474,9 +474,9 @@ PyObject* GeometryCurvePy::centerOfCurvature(PyObject *args) return new Base::VectorPy(new Base::Vector3d(V.X(),V.Y(),V.Z())); } } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } @@ -500,9 +500,9 @@ PyObject* GeometryCurvePy::parameter(PyObject *args) return Py::new_reference_to(Py::Float(val)); } } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } @@ -542,9 +542,9 @@ PyObject* GeometryCurvePy::makeRuledSurface(PyObject *args) return 0; } } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -577,9 +577,9 @@ PyObject* GeometryCurvePy::intersect2d(PyObject *args) } return Py::new_reference_to(list); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -599,9 +599,9 @@ PyObject* GeometryCurvePy::toBSpline(PyObject * args) return new BSplineCurvePy(spline); } } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } @@ -624,9 +624,9 @@ PyObject* GeometryCurvePy::toNurbs(PyObject * args) return new BSplineCurvePy(spline); } } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } @@ -648,9 +648,9 @@ PyObject* GeometryCurvePy::trim(PyObject * args) return Py::new_reference_to(makeTrimmedCurvePy(c,u,v)); } } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } @@ -702,9 +702,9 @@ PyObject* GeometryCurvePy::approximateBSpline(PyObject *args) return 0; } } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -800,9 +800,9 @@ PyObject* GeometryCurvePy::intersectCS(PyObject *args) return Py::new_reference_to(tuple); } } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PyExc_RuntimeError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PyExc_RuntimeError, e.GetMessageString()); return 0; } @@ -838,9 +838,9 @@ PyObject* GeometryCurvePy::intersectCC(PyObject *args) return Py::new_reference_to(points); } } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PyExc_RuntimeError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PyExc_RuntimeError, e.GetMessageString()); return 0; } @@ -869,9 +869,9 @@ PyObject* GeometryCurvePy::intersect(PyObject *args) return 0; } } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PyExc_RuntimeError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PyExc_RuntimeError, e.GetMessageString()); return 0; } diff --git a/src/Mod/Part/App/GeometrySurfacePyImp.cpp b/src/Mod/Part/App/GeometrySurfacePyImp.cpp index 2ba852f1d3..c037942aeb 100644 --- a/src/Mod/Part/App/GeometrySurfacePyImp.cpp +++ b/src/Mod/Part/App/GeometrySurfacePyImp.cpp @@ -268,9 +268,9 @@ PyObject* GeometrySurfacePy::toShape(PyObject *args) return new TopoShapeFacePy(new TopoShape(sh)); } } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } @@ -291,9 +291,9 @@ PyObject* GeometrySurfacePy::value(PyObject *args) return new Base::VectorPy(Base::Vector3d(p.X(),p.Y(),p.Z())); } } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } @@ -325,9 +325,9 @@ PyObject* GeometrySurfacePy::tangent(PyObject *args) return Py::new_reference_to(tuple); } } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } @@ -353,9 +353,9 @@ PyObject* GeometrySurfacePy::normal(PyObject *args) } } } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } @@ -376,9 +376,9 @@ PyObject* GeometrySurfacePy::isUmbillic(PyObject *args) return PyBool_FromLong(val ? 1 : 0); } } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } @@ -404,9 +404,9 @@ PyObject* GeometrySurfacePy::curvatureDirections(PyObject *args) return Py::new_reference_to(tuple); } } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } @@ -446,9 +446,9 @@ PyObject* GeometrySurfacePy::curvature(PyObject *args) return PyFloat_FromDouble(c); } } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } @@ -476,9 +476,9 @@ PyObject* GeometrySurfacePy::parameter(PyObject *args) return Py::new_reference_to(tuple); } } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } @@ -530,9 +530,9 @@ PyObject* GeometrySurfacePy::uIso(PyObject * args) return Py::new_reference_to(makeGeometryCurvePy(c)); } } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -564,9 +564,9 @@ PyObject* GeometrySurfacePy::vIso(PyObject * args) return Py::new_reference_to(makeGeometryCurvePy(c)); } } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -626,9 +626,9 @@ PyObject* GeometrySurfacePy::UPeriod(PyObject * args) Standard_Real val = surf->UPeriod(); return PyFloat_FromDouble(val); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -644,9 +644,9 @@ PyObject* GeometrySurfacePy::VPeriod(PyObject * args) Standard_Real val = surf->VPeriod(); return PyFloat_FromDouble(val); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -738,9 +738,9 @@ PyObject* GeometrySurfacePy::toBSpline(PyObject * args) Standard_Failure::Raise("Cannot convert to B-Spline surface"); } } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); } return 0; @@ -783,9 +783,9 @@ PyObject* GeometrySurfacePy::intersectSS(PyObject *args) return Py::new_reference_to(result); } } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PyExc_RuntimeError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PyExc_RuntimeError, e.GetMessageString()); return 0; } @@ -820,9 +820,9 @@ PyObject* GeometrySurfacePy::intersect(PyObject *args) } } } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PyExc_RuntimeError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PyExc_RuntimeError, e.GetMessageString()); return 0; } diff --git a/src/Mod/Part/App/ImportIges.cpp b/src/Mod/Part/App/ImportIges.cpp index 90c89f1baa..737fef22af 100644 --- a/src/Mod/Part/App/ImportIges.cpp +++ b/src/Mod/Part/App/ImportIges.cpp @@ -203,9 +203,8 @@ int Part::ImportIgesParts(App::Document *pcDoc, const char* FileName) } #endif } - catch (Standard_Failure) { - Handle(Standard_Failure) aFail = Standard_Failure::Caught(); - throw Base::Exception(aFail->GetMessageString()); + catch (Standard_Failure& e) { + throw Base::Exception(e.GetMessageString()); } return 0; diff --git a/src/Mod/Part/App/LinePyImp.cpp b/src/Mod/Part/App/LinePyImp.cpp index f2082bfa7e..6bb058b873 100644 --- a/src/Mod/Part/App/LinePyImp.cpp +++ b/src/Mod/Part/App/LinePyImp.cpp @@ -105,9 +105,9 @@ int LinePy::PyInit(PyObject* args, PyObject* /*kwd*/) this_curv->SetLin(that_curv->Lin()); return 0; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return -1; } catch (...) { @@ -168,9 +168,9 @@ void LinePy::setLocation(Py::Object arg) Handle(Geom_Line) that_curv = ms.Value(); this_curv->SetLin(that_curv->Lin()); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Py::Exception(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Py::Exception(e.GetMessageString()); } } @@ -218,9 +218,9 @@ void LinePy::setDirection(Py::Object arg) Handle(Geom_Line) that_curv = ms.Value(); this_curv->SetLin(that_curv->Lin()); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Py::Exception(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Py::Exception(e.GetMessageString()); } } diff --git a/src/Mod/Part/App/LineSegmentPyImp.cpp b/src/Mod/Part/App/LineSegmentPyImp.cpp index aab0d88960..2d8577cedc 100644 --- a/src/Mod/Part/App/LineSegmentPyImp.cpp +++ b/src/Mod/Part/App/LineSegmentPyImp.cpp @@ -164,9 +164,9 @@ int LineSegmentPy::PyInit(PyObject* args, PyObject* /*kwd*/) return 0; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return -1; } catch (...) { @@ -195,9 +195,9 @@ PyObject* LineSegmentPy::setParameterRange(PyObject *args) (this->getGeomLineSegmentPtr()->handle()); this_curve->SetTrim(first, last); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return NULL; } @@ -255,9 +255,9 @@ void LineSegmentPy::setStartPoint(Py::Object arg) this_line->SetLin(that_line->Lin()); this_curv->SetTrim(that_curv->FirstParameter(), that_curv->LastParameter()); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Py::Exception(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Py::Exception(e.GetMessageString()); } } @@ -312,9 +312,9 @@ void LineSegmentPy::setEndPoint(Py::Object arg) this_line->SetLin(that_line->Lin()); this_curv->SetTrim(that_curv->FirstParameter(), that_curv->LastParameter()); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Py::Exception(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Py::Exception(e.GetMessageString()); } } diff --git a/src/Mod/Part/App/OffsetCurvePyImp.cpp b/src/Mod/Part/App/OffsetCurvePyImp.cpp index 6d83451202..1849764e8a 100644 --- a/src/Mod/Part/App/OffsetCurvePyImp.cpp +++ b/src/Mod/Part/App/OffsetCurvePyImp.cpp @@ -75,9 +75,9 @@ int OffsetCurvePy::PyInit(PyObject* args, PyObject* /*kwd*/) getGeomOffsetCurvePtr()->setHandle(curve2); return 0; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return -1; } } @@ -144,9 +144,9 @@ void OffsetCurvePy::setBasisCurve(Py::Object arg) (getGeometryPtr()->handle()); curve2->SetBasisCurve(curve); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Py::Exception(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Py::Exception(e.GetMessageString()); } } } diff --git a/src/Mod/Part/App/OffsetSurfacePyImp.cpp b/src/Mod/Part/App/OffsetSurfacePyImp.cpp index c31f86a6ad..2e2996e47d 100644 --- a/src/Mod/Part/App/OffsetSurfacePyImp.cpp +++ b/src/Mod/Part/App/OffsetSurfacePyImp.cpp @@ -72,9 +72,9 @@ int OffsetSurfacePy::PyInit(PyObject* args, PyObject* /*kwd*/) getGeomOffsetSurfacePtr()->setHandle(surf2); return 0; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return -1; } } @@ -119,9 +119,9 @@ void OffsetSurfacePy::setBasisSurface(Py::Object arg) (getGeometryPtr()->handle()); surf2->SetBasisSurface(surf); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Py::Exception(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Py::Exception(e.GetMessageString()); } } } diff --git a/src/Mod/Part/App/PartFeature.cpp b/src/Mod/Part/App/PartFeature.cpp index b98214131c..d898eeee02 100644 --- a/src/Mod/Part/App/PartFeature.cpp +++ b/src/Mod/Part/App/PartFeature.cpp @@ -82,9 +82,9 @@ App::DocumentObjectExecReturn *Feature::recompute(void) try { return App::GeoFeature::recompute(); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - App::DocumentObjectExecReturn* ret = new App::DocumentObjectExecReturn(e->GetMessageString()); + catch (Standard_Failure& e) { + + App::DocumentObjectExecReturn* ret = new App::DocumentObjectExecReturn(e.GetMessageString()); if (ret->Why.empty()) ret->Why = "Unknown OCC exception"; return ret; } @@ -116,9 +116,9 @@ std::vector Feature::getPySubObjects(const std::vector& } return temp; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Py::ValueError(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Py::ValueError(e.GetMessageString()); } } diff --git a/src/Mod/Part/App/PartFeatures.cpp b/src/Mod/Part/App/PartFeatures.cpp index d3b9a67e6c..80ecc30b75 100644 --- a/src/Mod/Part/App/PartFeatures.cpp +++ b/src/Mod/Part/App/PartFeatures.cpp @@ -191,9 +191,9 @@ App::DocumentObjectExecReturn *RuledSurface::execute(void) } return App::DocumentObject::StdReturn; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - return new App::DocumentObjectExecReturn(e->GetMessageString()); + catch (Standard_Failure& e) { + + return new App::DocumentObjectExecReturn(e.GetMessageString()); } catch (...) { return new App::DocumentObjectExecReturn("General error in RuledSurface::execute()"); @@ -285,9 +285,9 @@ App::DocumentObjectExecReturn *Loft::execute(void) this->Shape.setValue(myShape.makeLoft(profiles, isSolid, isRuled,isClosed)); return App::DocumentObject::StdReturn; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - return new App::DocumentObjectExecReturn(e->GetMessageString()); + catch (Standard_Failure& e) { + + return new App::DocumentObjectExecReturn(e.GetMessageString()); } } @@ -382,7 +382,7 @@ App::DocumentObjectExecReturn *Sweep::execute(void) return new App::DocumentObjectExecReturn("Spine is neither an edge nor a wire."); } } - catch (Standard_Failure) { + catch (Standard_Failure&) { return new App::DocumentObjectExecReturn("Invalid spine."); } } @@ -465,9 +465,9 @@ App::DocumentObjectExecReturn *Sweep::execute(void) this->Shape.setValue(mkPipeShell.Shape()); return App::DocumentObject::StdReturn; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - return new App::DocumentObjectExecReturn(e->GetMessageString()); + catch (Standard_Failure& e) { + + return new App::DocumentObjectExecReturn(e.GetMessageString()); } catch (...) { return new App::DocumentObjectExecReturn("A fatal error occurred when making the sweep"); diff --git a/src/Mod/Part/App/PlanePyImp.cpp b/src/Mod/Part/App/PlanePyImp.cpp index e24d2b6635..863dd7fb22 100644 --- a/src/Mod/Part/App/PlanePyImp.cpp +++ b/src/Mod/Part/App/PlanePyImp.cpp @@ -207,9 +207,9 @@ void PlanePy::setPosition(Py::Object arg) (this->getGeomPlanePtr()->handle()); this_surf->SetLocation(loc); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Py::Exception(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Py::Exception(e.GetMessageString()); } } @@ -272,9 +272,8 @@ PyObject* PlanePy::uIso(PyObject * args) this_curv->SetLin(c->Lin()); return new LinePy(line); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -295,9 +294,8 @@ PyObject* PlanePy::vIso(PyObject * args) this_curv->SetLin(c->Lin()); return new LinePy(line); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } diff --git a/src/Mod/Part/App/PlateSurfacePyImp.cpp b/src/Mod/Part/App/PlateSurfacePyImp.cpp index 18e0f4e97f..bd2a60c168 100644 --- a/src/Mod/Part/App/PlateSurfacePyImp.cpp +++ b/src/Mod/Part/App/PlateSurfacePyImp.cpp @@ -130,9 +130,9 @@ int PlateSurfacePy::PyInit(PyObject* args, PyObject* kwds) getGeomPlateSurfacePtr()->setHandle(buildPlate.Surface()); return 0; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return -1; } } diff --git a/src/Mod/Part/App/PointPyImp.cpp b/src/Mod/Part/App/PointPyImp.cpp index 8748fd7bff..115e0a56d9 100644 --- a/src/Mod/Part/App/PointPyImp.cpp +++ b/src/Mod/Part/App/PointPyImp.cpp @@ -118,9 +118,9 @@ PyObject* PointPy::toShape(PyObject *args) return new TopoShapeVertexPy(new TopoShape(sh)); } } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } @@ -143,9 +143,9 @@ void PointPy::setX(Py::Float X) try { this_point->SetX(double(X)); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Py::Exception(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Py::Exception(e.GetMessageString()); } } @@ -164,9 +164,9 @@ void PointPy::setY(Py::Float Y) try { this_point->SetY(double(Y)); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Py::Exception(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Py::Exception(e.GetMessageString()); } } @@ -185,9 +185,9 @@ void PointPy::setZ(Py::Float Z) try { this_point->SetZ(double(Z)); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Py::Exception(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Py::Exception(e.GetMessageString()); } } diff --git a/src/Mod/Part/App/PrimitiveFeature.cpp b/src/Mod/Part/App/PrimitiveFeature.cpp index 91484cddb0..466bce3834 100644 --- a/src/Mod/Part/App/PrimitiveFeature.cpp +++ b/src/Mod/Part/App/PrimitiveFeature.cpp @@ -420,9 +420,9 @@ App::DocumentObjectExecReturn *Sphere::execute(void) TopoDS_Shape ResultShape = mkSphere.Shape(); this->Shape.setValue(ResultShape); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - return new App::DocumentObjectExecReturn(e->GetMessageString()); + catch (Standard_Failure& e) { + + return new App::DocumentObjectExecReturn(e.GetMessageString()); } return Primitive::execute(); @@ -502,9 +502,9 @@ App::DocumentObjectExecReturn *Ellipsoid::execute(void) TopoDS_Shape ResultShape = mkTrsf.Shape(); this->Shape.setValue(ResultShape); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - return new App::DocumentObjectExecReturn(e->GetMessageString()); + catch (Standard_Failure& e) { + + return new App::DocumentObjectExecReturn(e.GetMessageString()); } return Primitive::execute(); @@ -545,9 +545,9 @@ App::DocumentObjectExecReturn *Cylinder::execute(void) TopoDS_Shape ResultShape = mkCylr.Shape(); this->Shape.setValue(ResultShape); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - return new App::DocumentObjectExecReturn(e->GetMessageString()); + catch (Standard_Failure& e) { + + return new App::DocumentObjectExecReturn(e.GetMessageString()); } return Primitive::execute(); @@ -603,9 +603,9 @@ App::DocumentObjectExecReturn *Prism::execute(void) BRepPrimAPI_MakePrism mkPrism(mkFace.Face(), gp_Vec(0,0,Height.getValue())); this->Shape.setValue(mkPrism.Shape()); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - return new App::DocumentObjectExecReturn(e->GetMessageString()); + catch (Standard_Failure& e) { + + return new App::DocumentObjectExecReturn(e.GetMessageString()); } return Primitive::execute(); @@ -655,9 +655,9 @@ App::DocumentObjectExecReturn *RegularPolygon::execute(void) mkPoly.Add(gp_Pnt(v.x,v.y,v.z)); this->Shape.setValue(mkPoly.Shape()); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - return new App::DocumentObjectExecReturn(e->GetMessageString()); + catch (Standard_Failure& e) { + + return new App::DocumentObjectExecReturn(e.GetMessageString()); } return Primitive::execute(); @@ -705,9 +705,9 @@ App::DocumentObjectExecReturn *Cone::execute(void) TopoDS_Shape ResultShape = mkCone.Shape(); this->Shape.setValue(ResultShape); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - return new App::DocumentObjectExecReturn(e->GetMessageString()); + catch (Standard_Failure& e) { + + return new App::DocumentObjectExecReturn(e.GetMessageString()); } return Primitive::execute(); @@ -777,9 +777,9 @@ App::DocumentObjectExecReturn *Torus::execute(void) #endif this->Shape.setValue(ResultShape); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - return new App::DocumentObjectExecReturn(e->GetMessageString()); + catch (Standard_Failure& e) { + + return new App::DocumentObjectExecReturn(e.GetMessageString()); } return Primitive::execute(); @@ -858,9 +858,9 @@ App::DocumentObjectExecReturn *Helix::execute(void) // else // this->Shape.setValue(helix.makeHelix(myPitch, myHeight, myRadius, myAngle, myLocalCS, myStyle)); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - return new App::DocumentObjectExecReturn(e->GetMessageString()); + catch (Standard_Failure& e) { + + return new App::DocumentObjectExecReturn(e.GetMessageString()); } return Primitive::execute(); @@ -956,9 +956,9 @@ App::DocumentObjectExecReturn *Spiral::execute(void) Primitive::execute(); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - return new App::DocumentObjectExecReturn(e->GetMessageString()); + catch (Standard_Failure& e) { + + return new App::DocumentObjectExecReturn(e.GetMessageString()); } @@ -1043,9 +1043,9 @@ App::DocumentObjectExecReturn *Wedge::execute(void) mkSolid.Add(mkWedge.Shell()); this->Shape.setValue(mkSolid.Solid()); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - return new App::DocumentObjectExecReturn(e->GetMessageString()); + catch (Standard_Failure& e) { + + return new App::DocumentObjectExecReturn(e.GetMessageString()); } return Primitive::execute(); diff --git a/src/Mod/Part/App/RectangularTrimmedSurfacePyImp.cpp b/src/Mod/Part/App/RectangularTrimmedSurfacePyImp.cpp index 347853abb2..e0c719df6e 100644 --- a/src/Mod/Part/App/RectangularTrimmedSurfacePyImp.cpp +++ b/src/Mod/Part/App/RectangularTrimmedSurfacePyImp.cpp @@ -105,9 +105,9 @@ PyObject* RectangularTrimmedSurfacePy::uIso(PyObject * args) c->DynamicType()->Name()); return 0; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -131,9 +131,9 @@ PyObject* RectangularTrimmedSurfacePy::vIso(PyObject * args) c->DynamicType()->Name()); return 0; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } diff --git a/src/Mod/Part/App/SurfaceOfExtrusionPyImp.cpp b/src/Mod/Part/App/SurfaceOfExtrusionPyImp.cpp index ad5765dd14..201dc878d2 100644 --- a/src/Mod/Part/App/SurfaceOfExtrusionPyImp.cpp +++ b/src/Mod/Part/App/SurfaceOfExtrusionPyImp.cpp @@ -80,9 +80,9 @@ int SurfaceOfExtrusionPy::PyInit(PyObject* args, PyObject* /*kwd*/) getGeomSurfaceOfExtrusionPtr()->setHandle(curve2); return 0; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return -1; } } @@ -138,9 +138,9 @@ void SurfaceOfExtrusionPy::setBasisCurve(Py::Object arg) (getGeometryPtr()->handle()); curve2->SetBasisCurve(curve); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Py::Exception(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Py::Exception(e.GetMessageString()); } } } @@ -179,9 +179,9 @@ PyObject* SurfaceOfExtrusionPy::uIso(PyObject * args) c->DynamicType()->Name()); return 0; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -220,9 +220,9 @@ PyObject* SurfaceOfExtrusionPy::vIso(PyObject * args) c->DynamicType()->Name()); return 0; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } diff --git a/src/Mod/Part/App/SurfaceOfRevolutionPyImp.cpp b/src/Mod/Part/App/SurfaceOfRevolutionPyImp.cpp index 87a9c29dfd..b467accecf 100644 --- a/src/Mod/Part/App/SurfaceOfRevolutionPyImp.cpp +++ b/src/Mod/Part/App/SurfaceOfRevolutionPyImp.cpp @@ -77,9 +77,9 @@ int SurfaceOfRevolutionPy::PyInit(PyObject* args, PyObject* /*kwd*/) getGeomSurfaceOfRevolutionPtr()->setHandle(curve2); return 0; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return -1; } } @@ -165,9 +165,9 @@ void SurfaceOfRevolutionPy::setBasisCurve(Py::Object arg) (getGeometryPtr()->handle()); curve2->SetBasisCurve(curve); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Py::Exception(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Py::Exception(e.GetMessageString()); } } } diff --git a/src/Mod/Part/App/TopoShape.cpp b/src/Mod/Part/App/TopoShape.cpp index 5ab095957e..ca34694af4 100644 --- a/src/Mod/Part/App/TopoShape.cpp +++ b/src/Mod/Part/App/TopoShape.cpp @@ -515,9 +515,8 @@ void TopoShape::importIges(const char *FileName) this->_Shape = aReader.OneShape(); pi->EndScope(); } - catch (Standard_Failure) { - Handle(Standard_Failure) aFail = Standard_Failure::Caught(); - throw Base::Exception(aFail->GetMessageString()); + catch (Standard_Failure& e) { + throw Base::Exception(e.GetMessageString()); } } @@ -539,9 +538,8 @@ void TopoShape::importStep(const char *FileName) this->_Shape = aReader.OneShape(); pi->EndScope(); } - catch (Standard_Failure) { - Handle(Standard_Failure) aFail = Standard_Failure::Caught(); - throw Base::Exception(aFail->GetMessageString()); + catch (Standard_Failure& e) { + throw Base::Exception(e.GetMessageString()); } } @@ -562,9 +560,8 @@ void TopoShape::importBrep(const char *FileName) #endif this->_Shape = aShape; } - catch (Standard_Failure) { - Handle(Standard_Failure) aFail = Standard_Failure::Caught(); - throw Base::Exception(aFail->GetMessageString()); + catch (Standard_Failure& e) { + throw Base::Exception(e.GetMessageString()); } } @@ -585,9 +582,8 @@ void TopoShape::importBrep(std::istream& str) #endif this->_Shape = aShape; } - catch (Standard_Failure) { - Handle(Standard_Failure) aFail = Standard_Failure::Caught(); - throw Base::Exception(aFail->GetMessageString()); + catch (Standard_Failure& e) { + throw Base::Exception(e.GetMessageString()); } catch (const std::exception& e) { throw Base::Exception(e.what()); @@ -657,9 +653,8 @@ void TopoShape::exportIges(const char *filename) const if (aWriter.Write(encodeFilename(filename).c_str()) != IFSelect_RetDone) throw Base::Exception("Writing of IGES failed"); } - catch (Standard_Failure) { - Handle(Standard_Failure) aFail = Standard_Failure::Caught(); - throw Base::Exception(aFail->GetMessageString()); + catch (Standard_Failure& e) { + throw Base::Exception(e.GetMessageString()); } } @@ -690,9 +685,8 @@ void TopoShape::exportStep(const char *filename) const throw Base::Exception("Writing of STEP failed"); pi->EndScope(); } - catch (Standard_Failure) { - Handle(Standard_Failure) aFail = Standard_Failure::Caught(); - throw Base::Exception(aFail->GetMessageString()); + catch (Standard_Failure& e) { + throw Base::Exception(e.GetMessageString()); } } diff --git a/src/Mod/Part/App/TopoShapeCompSolidPyImp.cpp b/src/Mod/Part/App/TopoShapeCompSolidPyImp.cpp index 0888c62169..e1b15d9bbd 100644 --- a/src/Mod/Part/App/TopoShapeCompSolidPyImp.cpp +++ b/src/Mod/Part/App/TopoShapeCompSolidPyImp.cpp @@ -71,9 +71,9 @@ int TopoShapeCompSolidPy::PyInit(PyObject* args, PyObject* /*kwd*/) } } } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return -1; } @@ -98,9 +98,9 @@ PyObject* TopoShapeCompSolidPy::add(PyObject *args) else Standard_Failure::Raise("Cannot empty shape to compound solid"); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } diff --git a/src/Mod/Part/App/TopoShapeCompoundPyImp.cpp b/src/Mod/Part/App/TopoShapeCompoundPyImp.cpp index 4c44c8f092..b323c713e3 100644 --- a/src/Mod/Part/App/TopoShapeCompoundPyImp.cpp +++ b/src/Mod/Part/App/TopoShapeCompoundPyImp.cpp @@ -75,9 +75,9 @@ int TopoShapeCompoundPy::PyInit(PyObject* args, PyObject* /*kwd*/) } } } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return -1; } @@ -100,9 +100,9 @@ PyObject* TopoShapeCompoundPy::add(PyObject *args) if (!sh.IsNull()) builder.Add(comp, sh); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } @@ -140,9 +140,9 @@ PyObject* TopoShapeCompoundPy::connectEdgesToWires(PyObject *args) getTopoShapePtr()->setShape(comp); return new TopoShapeCompoundPy(new TopoShape(comp)); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } diff --git a/src/Mod/Part/App/TopoShapeEdgePyImp.cpp b/src/Mod/Part/App/TopoShapeEdgePyImp.cpp index e21927663e..eface64ecb 100644 --- a/src/Mod/Part/App/TopoShapeEdgePyImp.cpp +++ b/src/Mod/Part/App/TopoShapeEdgePyImp.cpp @@ -132,9 +132,9 @@ int TopoShapeEdgePy::PyInit(PyObject* args, PyObject* /*kwd*/) getTopoShapePtr()->setShape(mkEdge.Edge()); return 0; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return -1; } } @@ -165,9 +165,9 @@ int TopoShapeEdgePy::PyInit(PyObject* args, PyObject* /*kwd*/) getTopoShapePtr()->setShape(mkEdge.Edge()); return 0; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return -1; } } @@ -243,9 +243,9 @@ PyObject* TopoShapeEdgePy::parameterAt(PyObject *args) return PyFloat_FromDouble(par); } } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -286,9 +286,9 @@ PyObject* TopoShapeEdgePy::normalAt(PyObject *args) prop.Normal(V); return new Base::VectorPy(new Base::Vector3d(V.X(),V.Y(),V.Z())); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -307,9 +307,9 @@ PyObject* TopoShapeEdgePy::curvatureAt(PyObject *args) double C = prop.Curvature(); return Py::new_reference_to(Py::Float(C)); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -329,9 +329,9 @@ PyObject* TopoShapeEdgePy::centerOfCurvatureAt(PyObject *args) prop.CentreOfCurvature(V); return new Base::VectorPy(new Base::Vector3d(V.X(),V.Y(),V.Z())); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -350,9 +350,9 @@ PyObject* TopoShapeEdgePy::derivative1At(PyObject *args) const gp_Vec& V = prop.D1(); return new Base::VectorPy(new Base::Vector3d(V.X(),V.Y(),V.Z())); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -371,9 +371,9 @@ PyObject* TopoShapeEdgePy::derivative2At(PyObject *args) const gp_Vec& V = prop.D2(); return new Base::VectorPy(new Base::Vector3d(V.X(),V.Y(),V.Z())); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -392,9 +392,9 @@ PyObject* TopoShapeEdgePy::derivative3At(PyObject *args) const gp_Vec& V = prop.D3(); return new Base::VectorPy(new Base::Vector3d(V.X(),V.Y(),V.Z())); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -630,9 +630,9 @@ PyObject* TopoShapeEdgePy::split(PyObject *args) return new TopoShapeWirePy(new TopoShape(mkWire.Shape())); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -651,9 +651,9 @@ PyObject* TopoShapeEdgePy::isSeam(PyObject *args) Standard_Boolean ok = sa.IsSeam(e, f); return PyBool_FromLong(ok ? 1 : 0); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } diff --git a/src/Mod/Part/App/TopoShapeFacePyImp.cpp b/src/Mod/Part/App/TopoShapeFacePyImp.cpp index 69d47f7bd3..02d5dd0281 100644 --- a/src/Mod/Part/App/TopoShapeFacePyImp.cpp +++ b/src/Mod/Part/App/TopoShapeFacePyImp.cpp @@ -139,9 +139,9 @@ int TopoShapeFacePy::PyInit(PyObject* args, PyObject* /*kwd*/) return 0; } } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return -1; } } @@ -172,9 +172,9 @@ int TopoShapeFacePy::PyInit(PyObject* args, PyObject* /*kwd*/) getTopoShapePtr()->setShape(mkFace.Face()); return 0; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return -1; } } @@ -205,9 +205,9 @@ int TopoShapeFacePy::PyInit(PyObject* args, PyObject* /*kwd*/) getTopoShapePtr()->setShape(mkFace.Face()); return 0; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return -1; } } @@ -251,9 +251,9 @@ int TopoShapeFacePy::PyInit(PyObject* args, PyObject* /*kwd*/) getTopoShapePtr()->setShape(mkFace.Face()); return 0; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return -1; } } @@ -311,9 +311,9 @@ int TopoShapeFacePy::PyInit(PyObject* args, PyObject* /*kwd*/) Standard_Failure::Raise("no wires in list"); } } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return -1; } } @@ -358,9 +358,8 @@ int TopoShapeFacePy::PyInit(PyObject* args, PyObject* /*kwd*/) } catch (Base::Exception &e){ PyErr_SetString(Base::BaseExceptionFreeCADError, e.what()); return -1; - } catch (Standard_Failure){ - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + } catch (Standard_Failure& e){ + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return -1; } } @@ -506,9 +505,9 @@ PyObject* TopoShapeFacePy::derivative1At(PyObject *args) tuple.setItem(1, Py::Vector(Base::Vector3d(vecV.X(),vecV.Y(),vecV.Z()))); return Py::new_reference_to(tuple); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -531,9 +530,9 @@ PyObject* TopoShapeFacePy::derivative2At(PyObject *args) tuple.setItem(1, Py::Vector(Base::Vector3d(vecV.X(),vecV.Y(),vecV.Z()))); return Py::new_reference_to(tuple); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -558,9 +557,9 @@ PyObject* TopoShapeFacePy::isPartOfDomain(PyObject *args) TopAbs_State state = CL.Perform(gp_Pnt2d(u,v)); return PyBool_FromLong((state == TopAbs_ON || state == TopAbs_IN) ? 1 : 0); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -576,9 +575,9 @@ PyObject* TopoShapeFacePy::makeHalfSpace(PyObject *args) BRepPrimAPI_MakeHalfSpace mkHS(TopoDS::Face(this->getTopoShapePtr()->getShape()), gp_Pnt(pt.x,pt.y,pt.z)); return new TopoShapeSolidPy(new TopoShape(mkHS.Solid())); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -629,9 +628,9 @@ PyObject* TopoShapeFacePy::validate(PyObject *args) Py_Return; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -664,9 +663,9 @@ PyObject* TopoShapeFacePy::curveOnSurface(PyObject *args) tuple.setItem(2, Py::Float(last)); return Py::new_reference_to(tuple); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } diff --git a/src/Mod/Part/App/TopoShapePyImp.cpp b/src/Mod/Part/App/TopoShapePyImp.cpp index f155e159ef..c01f9b5880 100644 --- a/src/Mod/Part/App/TopoShapePyImp.cpp +++ b/src/Mod/Part/App/TopoShapePyImp.cpp @@ -145,9 +145,9 @@ int TopoShapePy::PyInit(PyObject* args, PyObject*) } } } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return -1; } @@ -469,9 +469,9 @@ PyObject* TopoShapePy::dumpToString(PyObject *args) PyErr_SetString(PartExceptionOCCError,e.what()); return NULL; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -495,9 +495,9 @@ PyObject* TopoShapePy::exportBrepToString(PyObject *args) PyErr_SetString(PartExceptionOCCError,e.what()); return NULL; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -582,9 +582,9 @@ PyObject* TopoShapePy::importBrepFromString(PyObject *args) PyErr_SetString(PartExceptionOCCError,e.what()); return NULL; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } @@ -623,9 +623,9 @@ PyObject* TopoShapePy::exportStl(PyObject *args) PyErr_SetString(PartExceptionOCCError,e.what()); return 0; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } @@ -667,9 +667,9 @@ PyObject* TopoShapePy::extrude(PyObject *args) PyErr_SetString(PartExceptionOCCError, "extrusion for this shape type not supported"); return 0; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -733,9 +733,9 @@ PyObject* TopoShapePy::revolve(PyObject *args) PyErr_SetString(PartExceptionOCCError, "revolution for this shape type not supported"); return 0; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -769,9 +769,9 @@ PyObject* TopoShapePy::fuse(PyObject *args) TopoDS_Shape fusShape = this->getTopoShapePtr()->fuse(shape); return new TopoShapePy(new TopoShape(fusShape)); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return NULL; } catch (const std::exception& e) { @@ -799,9 +799,9 @@ PyObject* TopoShapePy::fuse(PyObject *args) TopoDS_Shape multiFusedShape = this->getTopoShapePtr()->fuse(shapeVec,tolerance); return new TopoShapePy(new TopoShape(multiFusedShape)); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return NULL; } catch (const std::exception& e) { @@ -836,9 +836,9 @@ PyObject* TopoShapePy::multiFuse(PyObject *args) TopoDS_Shape multiFusedShape = this->getTopoShapePtr()->fuse(shapeVec,tolerance); return new TopoShapePy(new TopoShape(multiFusedShape)); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return NULL; } catch (const std::exception& e) { @@ -859,9 +859,9 @@ PyObject* TopoShapePy::oldFuse(PyObject *args) TopoDS_Shape fusShape = this->getTopoShapePtr()->oldFuse(shape); return new TopoShapePy(new TopoShape(fusShape)); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return NULL; } catch (const std::exception& e) { @@ -880,9 +880,9 @@ PyObject* TopoShapePy::common(PyObject *args) TopoDS_Shape comShape = this->getTopoShapePtr()->common(shape); return new TopoShapePy(new TopoShape(comShape)); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return NULL; } catch (const std::exception& e) { @@ -910,9 +910,9 @@ PyObject* TopoShapePy::common(PyObject *args) TopoDS_Shape multiCommonShape = this->getTopoShapePtr()->common(shapeVec,tolerance); return new TopoShapePy(new TopoShape(multiCommonShape)); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return NULL; } catch (const std::exception& e) { @@ -935,9 +935,9 @@ PyObject* TopoShapePy::section(PyObject *args) TopoDS_Shape secShape = this->getTopoShapePtr()->section(shape); return new TopoShapePy(new TopoShape(secShape)); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return NULL; } catch (const std::exception& e) { @@ -965,9 +965,9 @@ PyObject* TopoShapePy::section(PyObject *args) TopoDS_Shape multiSectionShape = this->getTopoShapePtr()->section(shapeVec,tolerance); return new TopoShapePy(new TopoShape(multiSectionShape)); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return NULL; } catch (const std::exception& e) { @@ -997,9 +997,9 @@ PyObject* TopoShapePy::slice(PyObject *args) return Py::new_reference_to(wire); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return NULL; } catch (const std::exception& e) { @@ -1024,9 +1024,9 @@ PyObject* TopoShapePy::slices(PyObject *args) TopoDS_Compound slice = this->getTopoShapePtr()->slices(vec, d); return new TopoShapeCompoundPy(new TopoShape(slice)); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return NULL; } catch (const std::exception& e) { @@ -1045,9 +1045,9 @@ PyObject* TopoShapePy::cut(PyObject *args) TopoDS_Shape cutShape = this->getTopoShapePtr()->cut(shape); return new TopoShapePy(new TopoShape(cutShape)); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return NULL; } catch (const std::exception& e) { @@ -1075,9 +1075,9 @@ PyObject* TopoShapePy::cut(PyObject *args) TopoDS_Shape multiCutShape = this->getTopoShapePtr()->cut(shapeVec,tolerance); return new TopoShapePy(new TopoShape(multiCutShape)); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return NULL; } catch (const std::exception& e) { @@ -1127,9 +1127,9 @@ PyObject* TopoShapePy::generalFuse(PyObject *args) ret[1] = mapPy; return Py::new_reference_to(ret); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return NULL; } catch (const std::exception& e) { @@ -1147,9 +1147,9 @@ PyObject* TopoShapePy::sewShape(PyObject *args) getTopoShapePtr()->sewShape(); Py_Return; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return NULL; } } @@ -1216,9 +1216,9 @@ PyObject* TopoShapePy::childShapes(PyObject *args) } return Py::new_reference_to(list); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return NULL; } } @@ -1285,9 +1285,9 @@ PyObject* TopoShapePy::ancestorsOfType(PyObject *args) return Py::new_reference_to(list); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return NULL; } } @@ -1304,9 +1304,9 @@ PyObject* TopoShapePy::removeInternalWires(PyObject *args) Py_INCREF(ret); return ret; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return NULL; } } @@ -1326,9 +1326,9 @@ PyObject* TopoShapePy::mirror(PyObject *args) TopoDS_Shape shape = this->getTopoShapePtr()->mirror(ax2); return new TopoShapePy(new TopoShape(shape)); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return NULL; } } @@ -1344,9 +1344,9 @@ PyObject* TopoShapePy::transformGeometry(PyObject *args) TopoDS_Shape shape = this->getTopoShapePtr()->transformGShape(mat); return new TopoShapePy(new TopoShape(shape)); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return NULL; } } @@ -1363,9 +1363,9 @@ PyObject* TopoShapePy::transformShape(PyObject *args) this->getTopoShapePtr()->transformShape(mat, PyObject_IsTrue(copy) ? true : false); Py_Return; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return NULL; } } @@ -1457,9 +1457,9 @@ PyObject* TopoShapePy::scale(PyObject *args) getTopoShapePtr()->setShape(BRepScale.Shape()); Py_Return; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return NULL; } } @@ -1485,9 +1485,9 @@ PyObject* TopoShapePy::makeFillet(PyObject *args) } return new TopoShapePy(new TopoShape(mkFillet.Shape())); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return NULL; } } @@ -1511,9 +1511,9 @@ PyObject* TopoShapePy::makeFillet(PyObject *args) } return new TopoShapePy(new TopoShape(mkFillet.Shape())); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return NULL; } } @@ -1550,9 +1550,9 @@ PyObject* TopoShapePy::makeChamfer(PyObject *args) } return new TopoShapePy(new TopoShape(mkChamfer.Shape())); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return NULL; } } @@ -1581,9 +1581,9 @@ PyObject* TopoShapePy::makeChamfer(PyObject *args) } return new TopoShapePy(new TopoShape(mkChamfer.Shape())); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return NULL; } } @@ -1623,9 +1623,9 @@ PyObject* TopoShapePy::makeThickness(PyObject *args) PyObject_IsTrue(inter) ? true : false, PyObject_IsTrue(self_inter) ? true : false, offsetMode, join); return new TopoShapeSolidPy(new TopoShape(shape)); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return NULL; } } @@ -1653,9 +1653,9 @@ PyObject* TopoShapePy::makeOffsetShape(PyObject *args, PyObject *keywds) PyObject_IsTrue(fill) ? true : false); return new TopoShapePy(new TopoShape(shape)); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return NULL; } } @@ -1841,9 +1841,9 @@ PyObject* TopoShapePy::tessellate(PyObject *args) tuple.setItem(1, facet); return Py::new_reference_to(tuple); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return NULL; } } @@ -1892,9 +1892,9 @@ PyObject* TopoShapePy::makeParallelProjection(PyObject *args) TopoDS_Shape projected = proj.Shape(); return new TopoShapePy(new TopoShape(projected)); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -1914,9 +1914,9 @@ PyObject* TopoShapePy::makePerspectiveProjection(PyObject *args) TopoDS_Shape projected = proj.Shape(); return new TopoShapePy(new TopoShape(projected)); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -1975,9 +1975,9 @@ PyObject* TopoShapePy::toNurbs(PyObject *args) TopoDS_Shape nurbs = this->getTopoShapePtr()->toNurbs(); return new TopoShapePy(new TopoShape(nurbs)); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return NULL; } } @@ -2001,9 +2001,9 @@ PyObject* TopoShapePy::isInside(PyObject *args) test = Standard_True; return Py_BuildValue("O", (test ? Py_True : Py_False)); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return NULL; } catch (const std::exception& e) { @@ -2022,9 +2022,9 @@ PyObject* TopoShapePy::removeSplitter(PyObject *args) TopoDS_Shape shape = this->getTopoShapePtr()->removeSplitter(); return new TopoShapePy(new TopoShape(shape)); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return NULL; } } @@ -2056,9 +2056,9 @@ PyObject* TopoShapePy::getElement(PyObject *args) return new TopoShapeVertexPy(new TopoShape(Shape)); } } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } return 0; @@ -2101,9 +2101,9 @@ PyObject* TopoShapePy::getTolerance(PyObject *args) double tolerance = analysis.Tolerance(shape, mode, shapetype); return PyFloat_FromDouble(tolerance); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return NULL; } } @@ -2151,9 +2151,9 @@ PyObject* TopoShapePy::overTolerance(PyObject *args) } return Py::new_reference_to(tuple); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return NULL; } } @@ -2202,9 +2202,9 @@ PyObject* TopoShapePy::inTolerance(PyObject *args) } return Py::new_reference_to(tuple); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return NULL; } } @@ -2223,9 +2223,9 @@ PyObject* TopoShapePy::globalTolerance(PyObject *args) double tolerance = analysis.GlobalTolerance(mode); return PyFloat_FromDouble(tolerance); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return NULL; } } @@ -2263,9 +2263,9 @@ PyObject* TopoShapePy::fixTolerance(PyObject *args) fix.SetTolerance(shape, value, shapetype); Py_Return; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return NULL; } } @@ -2304,9 +2304,9 @@ PyObject* TopoShapePy::limitTolerance(PyObject *args) Standard_Boolean ok = fix.LimitTolerance(shape, tmin, tmax, shapetype); return PyBool_FromLong(ok ? 1 : 0); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return NULL; } } @@ -2956,9 +2956,9 @@ PyObject *TopoShapePy::getCustomAttributes(const char* attr) const return new TopoShapeVertexPy(new TopoShape(Shape)); } } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } return 0; diff --git a/src/Mod/Part/App/TopoShapeShellPyImp.cpp b/src/Mod/Part/App/TopoShapeShellPyImp.cpp index 521b0ba81c..8999998e49 100644 --- a/src/Mod/Part/App/TopoShapeShellPyImp.cpp +++ b/src/Mod/Part/App/TopoShapeShellPyImp.cpp @@ -111,9 +111,9 @@ int TopoShapeShellPy::PyInit(PyObject* args, PyObject* /*kwd*/) if (shape.ShapeType() != TopAbs_SHELL) Standard_Failure::Raise("Shape is not a shell"); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return -1; } @@ -145,9 +145,9 @@ PyObject* TopoShapeShellPy::add(PyObject *args) Standard_Failure::Raise("cannot add empty shape"); } } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } @@ -197,9 +197,9 @@ PyObject* TopoShapeShellPy::makeHalfSpace(PyObject *args) BRepPrimAPI_MakeHalfSpace mkHS(TopoDS::Shell(this->getTopoShapePtr()->getShape()), gp_Pnt(pt.x,pt.y,pt.z)); return new TopoShapeSolidPy(new TopoShape(mkHS.Solid())); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } diff --git a/src/Mod/Part/App/TopoShapeSolidPyImp.cpp b/src/Mod/Part/App/TopoShapeSolidPyImp.cpp index 16ddd1a82b..42d00916e2 100644 --- a/src/Mod/Part/App/TopoShapeSolidPyImp.cpp +++ b/src/Mod/Part/App/TopoShapeSolidPyImp.cpp @@ -234,9 +234,9 @@ PyObject* TopoShapeSolidPy::getMomentOfInertia(PyObject *args) Base::convertTo(dir))); return PyFloat_FromDouble(r); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -257,9 +257,9 @@ PyObject* TopoShapeSolidPy::getRadiusOfGyration(PyObject *args) Base::convertTo(dir))); return PyFloat_FromDouble(r); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -317,9 +317,9 @@ PyObject* TopoShapeSolidPy::offsetFaces(PyObject *args) const TopoDS_Shape& offsetshape = builder.Shape(); return new TopoShapeSolidPy(new TopoShape(offsetshape)); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } diff --git a/src/Mod/Part/App/TopoShapeVertexPyImp.cpp b/src/Mod/Part/App/TopoShapeVertexPyImp.cpp index 8a6117b2e0..f03d916ab2 100644 --- a/src/Mod/Part/App/TopoShapeVertexPyImp.cpp +++ b/src/Mod/Part/App/TopoShapeVertexPyImp.cpp @@ -163,9 +163,9 @@ Py::Float TopoShapeVertexPy::getX(void) const const TopoDS_Vertex& v = TopoDS::Vertex(getTopoShapePtr()->getShape()); return Py::Float(BRep_Tool::Pnt(v).X()); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Py::RuntimeError(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Py::RuntimeError(e.GetMessageString()); } } @@ -175,9 +175,9 @@ Py::Float TopoShapeVertexPy::getY(void) const const TopoDS_Vertex& v = TopoDS::Vertex(getTopoShapePtr()->getShape()); return Py::Float(BRep_Tool::Pnt(v).Y()); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Py::RuntimeError(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Py::RuntimeError(e.GetMessageString()); } } @@ -187,9 +187,9 @@ Py::Float TopoShapeVertexPy::getZ(void) const const TopoDS_Vertex& v = TopoDS::Vertex(getTopoShapePtr()->getShape()); return Py::Float(BRep_Tool::Pnt(v).Z()); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Py::RuntimeError(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Py::RuntimeError(e.GetMessageString()); } } @@ -200,9 +200,9 @@ Py::Object TopoShapeVertexPy::getPoint(void) const gp_Pnt p = BRep_Tool::Pnt(v); return Py::asObject(new Base::VectorPy(new Base::Vector3d(p.X(),p.Y(),p.Z()))); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Py::RuntimeError(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Py::RuntimeError(e.GetMessageString()); } } diff --git a/src/Mod/Part/App/TopoShapeWirePyImp.cpp b/src/Mod/Part/App/TopoShapeWirePyImp.cpp index 9857cd5f20..c175f7d0e2 100644 --- a/src/Mod/Part/App/TopoShapeWirePyImp.cpp +++ b/src/Mod/Part/App/TopoShapeWirePyImp.cpp @@ -101,9 +101,9 @@ int TopoShapeWirePy::PyInit(PyObject* args, PyObject* /*kwd*/) getTopoShapePtr()->setShape(mkWire.Wire()); return 0; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return -1; } } @@ -144,9 +144,9 @@ int TopoShapeWirePy::PyInit(PyObject* args, PyObject* /*kwd*/) getTopoShapePtr()->setShape(mkWire.Wire()); return 0; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return -1; } } @@ -181,9 +181,9 @@ PyObject* TopoShapeWirePy::add(PyObject *args) getTopoShapePtr()->setShape(mkWire.Wire()); Py_Return; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -215,9 +215,9 @@ PyObject* TopoShapeWirePy::fixWire(PyObject *args) Py_Return; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -249,9 +249,9 @@ PyObject* TopoShapeWirePy::makePipe(PyObject *args) TopoDS_Shape shape = this->getTopoShapePtr()->makePipe(profile); return new TopoShapePy(new TopoShape(shape)); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -285,9 +285,9 @@ PyObject* TopoShapeWirePy::makePipeShell(PyObject *args) transition); return new TopoShapePy(new TopoShape(shape)); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return NULL; } } @@ -314,9 +314,9 @@ PyObject* TopoShapeWirePy::makeHomogenousWires(PyObject *args) return wire; } } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } diff --git a/src/Mod/Part/App/ToroidPyImp.cpp b/src/Mod/Part/App/ToroidPyImp.cpp index 3b3bb04076..33642b8b0b 100644 --- a/src/Mod/Part/App/ToroidPyImp.cpp +++ b/src/Mod/Part/App/ToroidPyImp.cpp @@ -78,9 +78,9 @@ PyObject* ToroidPy::uIso(PyObject * args) Handle(Geom_Circle) c = Handle(Geom_Circle)::DownCast(torus->UIso(u)); return new CirclePy(new GeomCircle(c)); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } @@ -97,9 +97,9 @@ PyObject* ToroidPy::vIso(PyObject * args) Handle(Geom_Circle) c = Handle(Geom_Circle)::DownCast(torus->VIso(v)); return new CirclePy(new GeomCircle(c)); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + PyErr_SetString(PartExceptionOCCError, e.GetMessageString()); return 0; } } diff --git a/src/Mod/Part/App/modelRefine.cpp b/src/Mod/Part/App/modelRefine.cpp index bc941cc2de..29f07d9d32 100644 --- a/src/Mod/Part/App/modelRefine.cpp +++ b/src/Mod/Part/App/modelRefine.cpp @@ -892,12 +892,11 @@ bool FaceTypedBSpline::isEqual(const TopoDS_Face &faceOne, const TopoDS_Face &fa return false; return true; } - catch (Standard_Failure) + catch (Standard_Failure& e) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); std::ostringstream stream; - if (!e.IsNull() && e->GetMessageString()) - stream << "FaceTypedBSpline::isEqual: OCC Error: " << e->GetMessageString() << std::endl; + if (e.GetMessageString()) + stream << "FaceTypedBSpline::isEqual: OCC Error: " << e.GetMessageString() << std::endl; else stream << "FaceTypedBSpline::isEqual: Unknown OCC Error" << std::endl; Base::Console().Message(stream.str().c_str()); diff --git a/src/Mod/PartDesign/App/FeatureChamfer.cpp b/src/Mod/PartDesign/App/FeatureChamfer.cpp index b1d8f7461a..4dd226e3e5 100644 --- a/src/Mod/PartDesign/App/FeatureChamfer.cpp +++ b/src/Mod/PartDesign/App/FeatureChamfer.cpp @@ -127,9 +127,8 @@ App::DocumentObjectExecReturn *Chamfer::execute(void) this->Shape.setValue(getSolid(shape)); return App::DocumentObject::StdReturn; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - return new App::DocumentObjectExecReturn(e->GetMessageString()); + catch (Standard_Failure& e) { + return new App::DocumentObjectExecReturn(e.GetMessageString()); } } diff --git a/src/Mod/PartDesign/App/FeatureDraft.cpp b/src/Mod/PartDesign/App/FeatureDraft.cpp index 342f499c01..9017645937 100644 --- a/src/Mod/PartDesign/App/FeatureDraft.cpp +++ b/src/Mod/PartDesign/App/FeatureDraft.cpp @@ -305,8 +305,8 @@ App::DocumentObjectExecReturn *Draft::execute(void) this->Shape.setValue(getSolid(shape)); return App::DocumentObject::StdReturn; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - return new App::DocumentObjectExecReturn(e->GetMessageString()); + catch (Standard_Failure& e) { + + return new App::DocumentObjectExecReturn(e.GetMessageString()); } } diff --git a/src/Mod/PartDesign/App/FeatureFillet.cpp b/src/Mod/PartDesign/App/FeatureFillet.cpp index 0818a1a26b..ad4f79e96c 100644 --- a/src/Mod/PartDesign/App/FeatureFillet.cpp +++ b/src/Mod/PartDesign/App/FeatureFillet.cpp @@ -121,9 +121,8 @@ App::DocumentObjectExecReturn *Fillet::execute(void) this->Shape.setValue(getSolid(shape)); return App::DocumentObject::StdReturn; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - return new App::DocumentObjectExecReturn(e->GetMessageString()); + catch (Standard_Failure& e) { + return new App::DocumentObjectExecReturn(e.GetMessageString()); } } diff --git a/src/Mod/PartDesign/App/FeatureGroove.cpp b/src/Mod/PartDesign/App/FeatureGroove.cpp index 32c085eec7..b2af6fc91a 100644 --- a/src/Mod/PartDesign/App/FeatureGroove.cpp +++ b/src/Mod/PartDesign/App/FeatureGroove.cpp @@ -164,13 +164,13 @@ App::DocumentObjectExecReturn *Groove::execute(void) return App::DocumentObject::StdReturn; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - if (std::string(e->GetMessageString()) == "TopoDS::Face") + catch (Standard_Failure& e) { + + if (std::string(e.GetMessageString()) == "TopoDS::Face") return new App::DocumentObjectExecReturn("Could not create face from sketch.\n" "Intersecting sketch entities in a sketch are not allowed."); else - return new App::DocumentObjectExecReturn(e->GetMessageString()); + return new App::DocumentObjectExecReturn(e.GetMessageString()); } catch (Base::Exception& e) { return new App::DocumentObjectExecReturn(e.what()); diff --git a/src/Mod/PartDesign/App/FeatureHole.cpp b/src/Mod/PartDesign/App/FeatureHole.cpp index e7b1ab1094..deb9614136 100644 --- a/src/Mod/PartDesign/App/FeatureHole.cpp +++ b/src/Mod/PartDesign/App/FeatureHole.cpp @@ -1252,15 +1252,14 @@ App::DocumentObjectExecReturn *Hole::execute(void) return App::DocumentObject::StdReturn; } - catch (Standard_Failure) { - Handle_Standard_Failure e = Standard_Failure::Caught(); - if (std::string(e->GetMessageString()) == "TopoDS::Face" && + catch (Standard_Failure& e) { + if (std::string(e.GetMessageString()) == "TopoDS::Face" && (std::string(DepthType.getValueAsString()) == "UpToFirst" || std::string(DepthType.getValueAsString()) == "UpToFace")) return new App::DocumentObjectExecReturn("Could not create face from sketch.\n" "Intersecting sketch entities or multiple faces in a sketch are not allowed " "for making a pocket up to a face."); else - return new App::DocumentObjectExecReturn(e->GetMessageString()); + return new App::DocumentObjectExecReturn(e.GetMessageString()); } catch (Base::Exception& e) { return new App::DocumentObjectExecReturn(e.what()); diff --git a/src/Mod/PartDesign/App/FeatureLoft.cpp b/src/Mod/PartDesign/App/FeatureLoft.cpp index a646f8cfb2..7736046952 100644 --- a/src/Mod/PartDesign/App/FeatureLoft.cpp +++ b/src/Mod/PartDesign/App/FeatureLoft.cpp @@ -214,9 +214,9 @@ App::DocumentObjectExecReturn *Loft::execute(void) return App::DocumentObject::StdReturn; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - return new App::DocumentObjectExecReturn(e->GetMessageString()); + catch (Standard_Failure& e) { + + return new App::DocumentObjectExecReturn(e.GetMessageString()); } catch (...) { return new App::DocumentObjectExecReturn("Loft: A fatal error occurred when making the loft"); diff --git a/src/Mod/PartDesign/App/FeaturePad.cpp b/src/Mod/PartDesign/App/FeaturePad.cpp index 47c4b90bfc..0762844cf8 100644 --- a/src/Mod/PartDesign/App/FeaturePad.cpp +++ b/src/Mod/PartDesign/App/FeaturePad.cpp @@ -233,13 +233,13 @@ App::DocumentObjectExecReturn *Pad::execute(void) return App::DocumentObject::StdReturn; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - if (std::string(e->GetMessageString()) == "TopoDS::Face") + catch (Standard_Failure& e) { + + if (std::string(e.GetMessageString()) == "TopoDS::Face") return new App::DocumentObjectExecReturn("Could not create face from sketch.\n" "Intersecting sketch entities or multiple faces in a sketch are not allowed."); else - return new App::DocumentObjectExecReturn(e->GetMessageString()); + return new App::DocumentObjectExecReturn(e.GetMessageString()); } catch (Base::Exception& e) { return new App::DocumentObjectExecReturn(e.what()); diff --git a/src/Mod/PartDesign/App/FeaturePipe.cpp b/src/Mod/PartDesign/App/FeaturePipe.cpp index 860a3e09e7..ac8b071b97 100644 --- a/src/Mod/PartDesign/App/FeaturePipe.cpp +++ b/src/Mod/PartDesign/App/FeaturePipe.cpp @@ -321,9 +321,9 @@ App::DocumentObjectExecReturn *Pipe::execute(void) return App::DocumentObject::StdReturn; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - return new App::DocumentObjectExecReturn(e->GetMessageString()); + catch (Standard_Failure& e) { + + return new App::DocumentObjectExecReturn(e.GetMessageString()); } catch (...) { return new App::DocumentObjectExecReturn("A fatal error occurred when making the pipe"); diff --git a/src/Mod/PartDesign/App/FeaturePocket.cpp b/src/Mod/PartDesign/App/FeaturePocket.cpp index dc80973b23..b2a6b1c4b6 100644 --- a/src/Mod/PartDesign/App/FeaturePocket.cpp +++ b/src/Mod/PartDesign/App/FeaturePocket.cpp @@ -203,15 +203,15 @@ App::DocumentObjectExecReturn *Pocket::execute(void) return App::DocumentObject::StdReturn; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - if (std::string(e->GetMessageString()) == "TopoDS::Face" && + catch (Standard_Failure& e) { + + if (std::string(e.GetMessageString()) == "TopoDS::Face" && (std::string(Type.getValueAsString()) == "UpToFirst" || std::string(Type.getValueAsString()) == "UpToFace")) return new App::DocumentObjectExecReturn("Could not create face from sketch.\n" "Intersecting sketch entities or multiple faces in a sketch are not allowed " "for making a pocket up to a face."); else - return new App::DocumentObjectExecReturn(e->GetMessageString()); + return new App::DocumentObjectExecReturn(e.GetMessageString()); } catch (Base::Exception& e) { return new App::DocumentObjectExecReturn(e.what()); diff --git a/src/Mod/PartDesign/App/FeaturePrimitive.cpp b/src/Mod/PartDesign/App/FeaturePrimitive.cpp index 079acb8a3c..a5f17ef147 100644 --- a/src/Mod/PartDesign/App/FeaturePrimitive.cpp +++ b/src/Mod/PartDesign/App/FeaturePrimitive.cpp @@ -147,9 +147,9 @@ App::DocumentObjectExecReturn* FeaturePrimitive::execute(const TopoDS_Shape& pri } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - return new App::DocumentObjectExecReturn(e->GetMessageString()); + catch (Standard_Failure& e) { + + return new App::DocumentObjectExecReturn(e.GetMessageString()); } return App::DocumentObject::StdReturn; @@ -206,9 +206,9 @@ App::DocumentObjectExecReturn* Box::execute(void) BRepPrimAPI_MakeBox mkBox(L, W, H); return FeaturePrimitive::execute(mkBox.Shape()); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - return new App::DocumentObjectExecReturn(e->GetMessageString()); + catch (Standard_Failure& e) { + + return new App::DocumentObjectExecReturn(e.GetMessageString()); } } @@ -254,9 +254,9 @@ App::DocumentObjectExecReturn* Cylinder::execute(void) return FeaturePrimitive::execute(mkCylr.Shape()); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - return new App::DocumentObjectExecReturn(e->GetMessageString()); + catch (Standard_Failure& e) { + + return new App::DocumentObjectExecReturn(e.GetMessageString()); } return App::DocumentObject::StdReturn; @@ -304,9 +304,9 @@ App::DocumentObjectExecReturn* Sphere::execute(void) Angle3.getValue()/180.0f*M_PI); return FeaturePrimitive::execute(mkSphere.Shape()); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - return new App::DocumentObjectExecReturn(e->GetMessageString()); + catch (Standard_Failure& e) { + + return new App::DocumentObjectExecReturn(e.GetMessageString()); } return App::DocumentObject::StdReturn; @@ -360,9 +360,9 @@ App::DocumentObjectExecReturn* Cone::execute(void) return FeaturePrimitive::execute(mkCone.Shape()); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - return new App::DocumentObjectExecReturn(e->GetMessageString()); + catch (Standard_Failure& e) { + + return new App::DocumentObjectExecReturn(e.GetMessageString()); } return App::DocumentObject::StdReturn; @@ -442,9 +442,9 @@ App::DocumentObjectExecReturn* Ellipsoid::execute(void) BRepBuilderAPI_GTransform mkTrsf(mkSphere.Shape(), mat); return FeaturePrimitive::execute(mkTrsf.Shape()); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - return new App::DocumentObjectExecReturn(e->GetMessageString()); + catch (Standard_Failure& e) { + + return new App::DocumentObjectExecReturn(e.GetMessageString()); } return App::DocumentObject::StdReturn; @@ -505,9 +505,9 @@ App::DocumentObjectExecReturn* Torus::execute(void) Angle3.getValue()/180.0f*M_PI); return FeaturePrimitive::execute(mkTorus.Solid()); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - return new App::DocumentObjectExecReturn(e->GetMessageString()); + catch (Standard_Failure& e) { + + return new App::DocumentObjectExecReturn(e.GetMessageString()); } return App::DocumentObject::StdReturn; @@ -571,9 +571,9 @@ App::DocumentObjectExecReturn* Prism::execute(void) BRepPrimAPI_MakePrism mkPrism(mkFace.Face(), gp_Vec(0,0,Height.getValue())); return FeaturePrimitive::execute(mkPrism.Shape()); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - return new App::DocumentObjectExecReturn(e->GetMessageString()); + catch (Standard_Failure& e) { + + return new App::DocumentObjectExecReturn(e.GetMessageString()); } return App::DocumentObject::StdReturn; @@ -658,9 +658,9 @@ App::DocumentObjectExecReturn* Wedge::execute(void) mkSolid.Add(mkWedge.Shell()); return FeaturePrimitive::execute(mkSolid.Solid()); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - return new App::DocumentObjectExecReturn(e->GetMessageString()); + catch (Standard_Failure& e) { + + return new App::DocumentObjectExecReturn(e.GetMessageString()); } return App::DocumentObject::StdReturn; diff --git a/src/Mod/PartDesign/App/FeatureRevolution.cpp b/src/Mod/PartDesign/App/FeatureRevolution.cpp index 54ba7c57e6..fca80d6191 100644 --- a/src/Mod/PartDesign/App/FeatureRevolution.cpp +++ b/src/Mod/PartDesign/App/FeatureRevolution.cpp @@ -169,13 +169,13 @@ App::DocumentObjectExecReturn *Revolution::execute(void) return App::DocumentObject::StdReturn; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - if (std::string(e->GetMessageString()) == "TopoDS::Face") + catch (Standard_Failure& e) { + + if (std::string(e.GetMessageString()) == "TopoDS::Face") return new App::DocumentObjectExecReturn("Could not create face from sketch.\n" "Intersecting sketch entities in a sketch are not allowed."); else - return new App::DocumentObjectExecReturn(e->GetMessageString()); + return new App::DocumentObjectExecReturn(e.GetMessageString()); } catch (Base::Exception& e) { return new App::DocumentObjectExecReturn(e.what()); diff --git a/src/Mod/PartDesign/App/FeatureTransformed.cpp b/src/Mod/PartDesign/App/FeatureTransformed.cpp index 6bfa55c2ed..0c4aae8c0d 100644 --- a/src/Mod/PartDesign/App/FeatureTransformed.cpp +++ b/src/Mod/PartDesign/App/FeatureTransformed.cpp @@ -346,13 +346,13 @@ App::DocumentObjectExecReturn *Transformed::execute(void) } support = current; // Use result of this operation for fuse/cut of next original } - } catch (Standard_Failure) { + } catch (Standard_Failure& e) { // Note: Ignoring this failure is probably pointless because if the intersection check fails, the later // fuse operation of the transformation result will also fail - Handle(Standard_Failure) e = Standard_Failure::Caught(); + std::string msg("Transformation: Intersection check failed"); - if (e->GetMessageString() != NULL) - msg += std::string(": '") + e->GetMessageString() + "'"; + if (e.GetMessageString() != NULL) + msg += std::string(": '") + e.GetMessageString() + "'"; return new App::DocumentObjectExecReturn(msg.c_str()); } } diff --git a/src/Mod/Robot/App/PropertyTrajectory.cpp b/src/Mod/Robot/App/PropertyTrajectory.cpp index 9282cb9c79..9ccc3e2abb 100644 --- a/src/Mod/Robot/App/PropertyTrajectory.cpp +++ b/src/Mod/Robot/App/PropertyTrajectory.cpp @@ -84,7 +84,7 @@ Base::BoundBox3d PropertyTrajectory::getBoundingBox() const // box.MinZ = zMin; // box.MaxZ = zMax; //} - //catch (Standard_Failure) { + //catch (Standard_Failure& e) { //} return box; diff --git a/src/Mod/Sketcher/App/SketchObject.cpp b/src/Mod/Sketcher/App/SketchObject.cpp index b4cd0bd8d8..699fdb17a3 100644 --- a/src/Mod/Sketcher/App/SketchObject.cpp +++ b/src/Mod/Sketcher/App/SketchObject.cpp @@ -4796,9 +4796,9 @@ void SketchObject::rebuildExternalGeometry(void) const Part::TopoShape& refShape=refObj->Shape.getShape(); refSubShape = refShape.getSubShape(SubElement.c_str()); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Base::Exception(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Base::Exception(e.GetMessageString()); } } else if (Obj->getTypeId().isDerivedFrom(App::Plane::getClassTypeId())) { const App::Plane* pl = static_cast(Obj); @@ -5065,9 +5065,9 @@ void SketchObject::rebuildExternalGeometry(void) } } } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Base::Exception(e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Base::Exception(e.GetMessageString()); } } } diff --git a/src/Mod/Surface/App/FeatureCut.cpp b/src/Mod/Surface/App/FeatureCut.cpp index d992797977..5d304e9dc1 100644 --- a/src/Mod/Surface/App/FeatureCut.cpp +++ b/src/Mod/Surface/App/FeatureCut.cpp @@ -96,8 +96,8 @@ App::DocumentObjectExecReturn *Cut::execute(void) this->Shape.setValue(aCutShape); return 0; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - return new App::DocumentObjectExecReturn(e->GetMessageString()); + catch (Standard_Failure& e) { + + return new App::DocumentObjectExecReturn(e.GetMessageString()); } } diff --git a/src/Mod/Surface/App/FeatureFilling.cpp b/src/Mod/Surface/App/FeatureFilling.cpp index b7a7abd1ca..6f95a571ed 100644 --- a/src/Mod/Surface/App/FeatureFilling.cpp +++ b/src/Mod/Surface/App/FeatureFilling.cpp @@ -290,8 +290,8 @@ App::DocumentObjectExecReturn *Filling::execute(void) this->Shape.setValue(aFace); return App::DocumentObject::StdReturn; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - return new App::DocumentObjectExecReturn(e->GetMessageString()); + catch (Standard_Failure& e) { + + return new App::DocumentObjectExecReturn(e.GetMessageString()); } } diff --git a/src/Mod/Surface/App/FeatureGeomFillSurface.cpp b/src/Mod/Surface/App/FeatureGeomFillSurface.cpp index 0e8818cf66..25c0cadd57 100644 --- a/src/Mod/Surface/App/FeatureGeomFillSurface.cpp +++ b/src/Mod/Surface/App/FeatureGeomFillSurface.cpp @@ -166,9 +166,9 @@ App::DocumentObjectExecReturn *GeomFillSurface::execute(void) catch (StdFail_NotDone) { return new App::DocumentObjectExecReturn("A curve was not a b-spline and could not be converted into one."); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - return new App::DocumentObjectExecReturn(e->GetMessageString()); + catch (Standard_Failure& e) { + + return new App::DocumentObjectExecReturn(e.GetMessageString()); } } diff --git a/src/Mod/Surface/App/FeatureSewing.cpp b/src/Mod/Surface/App/FeatureSewing.cpp index 4b25a7f10f..8c51cd2ae4 100644 --- a/src/Mod/Surface/App/FeatureSewing.cpp +++ b/src/Mod/Surface/App/FeatureSewing.cpp @@ -102,8 +102,8 @@ App::DocumentObjectExecReturn *Sewing::execute(void) this->Shape.setValue(aShape); return StdReturn; } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - return new App::DocumentObjectExecReturn(e->GetMessageString()); + catch (Standard_Failure& e) { + + return new App::DocumentObjectExecReturn(e.GetMessageString()); } } diff --git a/src/Mod/TechDraw/App/AppTechDrawPy.cpp b/src/Mod/TechDraw/App/AppTechDrawPy.cpp index d77143181a..bb26caf7b3 100644 --- a/src/Mod/TechDraw/App/AppTechDrawPy.cpp +++ b/src/Mod/TechDraw/App/AppTechDrawPy.cpp @@ -148,9 +148,9 @@ private: } } } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Py::Exception(Part::PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Py::Exception(Part::PartExceptionOCCError, e.GetMessageString()); } if (edgeList.empty()) { @@ -206,9 +206,9 @@ private: } } } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Py::Exception(Part::PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Py::Exception(Part::PartExceptionOCCError, e.GetMessageString()); } if (edgeList.empty()) { @@ -270,9 +270,9 @@ private: try { edgeList = DrawProjectSplit::getEdgesForWalker(shape,scale,dir); } - catch (Standard_Failure) { - Handle(Standard_Failure) e = Standard_Failure::Caught(); - throw Py::Exception(Part::PartExceptionOCCError, e->GetMessageString()); + catch (Standard_Failure& e) { + + throw Py::Exception(Part::PartExceptionOCCError, e.GetMessageString()); } if (edgeList.empty()) { diff --git a/src/Mod/TechDraw/App/DrawViewDetail.cpp b/src/Mod/TechDraw/App/DrawViewDetail.cpp index d3299f018b..b9f7a182dd 100644 --- a/src/Mod/TechDraw/App/DrawViewDetail.cpp +++ b/src/Mod/TechDraw/App/DrawViewDetail.cpp @@ -255,19 +255,17 @@ App::DocumentObjectExecReturn *DrawViewDetail::execute(void) try { extractFaces(); } - catch (Standard_Failure) { - Handle(Standard_Failure) e4 = Standard_Failure::Caught(); - Base::Console().Log("LOG - DVD::execute - extractFaces failed for %s - %s **\n",getNameInDocument(),e4->GetMessageString()); - return new App::DocumentObjectExecReturn(e4->GetMessageString()); + catch (Standard_Failure& e4) { + Base::Console().Log("LOG - DVD::execute - extractFaces failed for %s - %s **\n",getNameInDocument(),e4.GetMessageString()); + return new App::DocumentObjectExecReturn(e4.GetMessageString()); } } #endif //#if MOD_TECHDRAW_HANDLE_FACES } - catch (Standard_Failure) { - Handle(Standard_Failure) e1 = Standard_Failure::Caught(); - Base::Console().Log("LOG - DVD::execute - base shape failed for %s - %s **\n",getNameInDocument(),e1->GetMessageString()); - return new App::DocumentObjectExecReturn(e1->GetMessageString()); + catch (Standard_Failure& e1) { + Base::Console().Log("LOG - DVD::execute - base shape failed for %s - %s **\n",getNameInDocument(),e1.GetMessageString()); + return new App::DocumentObjectExecReturn(e1.GetMessageString()); } diff --git a/src/Mod/TechDraw/App/DrawViewMulti.cpp b/src/Mod/TechDraw/App/DrawViewMulti.cpp index bb1d7716d5..0bd03b48ad 100644 --- a/src/Mod/TechDraw/App/DrawViewMulti.cpp +++ b/src/Mod/TechDraw/App/DrawViewMulti.cpp @@ -153,10 +153,9 @@ App::DocumentObjectExecReturn *DrawViewMulti::execute(void) extractFaces(); #endif //#if MOD_TECHDRAW_HANDLE_FACES } - catch (Standard_Failure) { - Handle(Standard_Failure) e1 = Standard_Failure::Caught(); - Base::Console().Log("LOG - DVM::execute - projection failed for %s - %s **\n",getNameInDocument(),e1->GetMessageString()); - return new App::DocumentObjectExecReturn(e1->GetMessageString()); + catch (Standard_Failure& e1) { + Base::Console().Log("LOG - DVM::execute - projection failed for %s - %s **\n",getNameInDocument(),e1.GetMessageString()); + return new App::DocumentObjectExecReturn(e1.GetMessageString()); } return App::DocumentObject::StdReturn; diff --git a/src/Mod/TechDraw/App/DrawViewPart.cpp b/src/Mod/TechDraw/App/DrawViewPart.cpp index 42f5c47311..2a51a9b530 100644 --- a/src/Mod/TechDraw/App/DrawViewPart.cpp +++ b/src/Mod/TechDraw/App/DrawViewPart.cpp @@ -192,10 +192,9 @@ App::DocumentObjectExecReturn *DrawViewPart::execute(void) try { extractFaces(); } - catch (Standard_Failure) { - Handle(Standard_Failure) e4 = Standard_Failure::Caught(); - Base::Console().Log("LOG - DVP::execute - extractFaces failed for %s - %s **\n",getNameInDocument(),e4->GetMessageString()); - return new App::DocumentObjectExecReturn(e4->GetMessageString()); + catch (Standard_Failure& e4) { + Base::Console().Log("LOG - DVP::execute - extractFaces failed for %s - %s **\n",getNameInDocument(),e4.GetMessageString()); + return new App::DocumentObjectExecReturn(e4.GetMessageString()); } } #endif //#if MOD_TECHDRAW_HANDLE_FACES diff --git a/src/Mod/TechDraw/App/DrawViewSection.cpp b/src/Mod/TechDraw/App/DrawViewSection.cpp index 172cbf113c..f331e2e6e1 100644 --- a/src/Mod/TechDraw/App/DrawViewSection.cpp +++ b/src/Mod/TechDraw/App/DrawViewSection.cpp @@ -264,10 +264,9 @@ App::DocumentObjectExecReturn *DrawViewSection::execute(void) extractFaces(); #endif //#if MOD_TECHDRAW_HANDLE_FACES } - catch (Standard_Failure) { - Handle(Standard_Failure) e1 = Standard_Failure::Caught(); - Base::Console().Log("LOG - DVS::execute - base shape failed for %s - %s **\n",getNameInDocument(),e1->GetMessageString()); - return new App::DocumentObjectExecReturn(e1->GetMessageString()); + catch (Standard_Failure& e1) { + Base::Console().Log("LOG - DVS::execute - base shape failed for %s - %s **\n",getNameInDocument(),e1.GetMessageString()); + return new App::DocumentObjectExecReturn(e1.GetMessageString()); } try { @@ -295,10 +294,9 @@ App::DocumentObjectExecReturn *DrawViewSection::execute(void) } sectionFaces = newFaces; } - catch (Standard_Failure) { - Handle(Standard_Failure) e2 = Standard_Failure::Caught(); - Base::Console().Log("LOG - DVS::execute - failed building section faces for %s - %s **\n",getNameInDocument(),e2->GetMessageString()); - return new App::DocumentObjectExecReturn(e2->GetMessageString()); + catch (Standard_Failure& e2) { + Base::Console().Log("LOG - DVS::execute - failed building section faces for %s - %s **\n",getNameInDocument(),e2.GetMessageString()); + return new App::DocumentObjectExecReturn(e2.GetMessageString()); } return App::DocumentObject::StdReturn;