diff --git a/src/Mod/Import/App/AppImportPy.cpp b/src/Mod/Import/App/AppImportPy.cpp index ce9d20fecc..496a750647 100644 --- a/src/Mod/Import/App/AppImportPy.cpp +++ b/src/Mod/Import/App/AppImportPy.cpp @@ -350,7 +350,7 @@ static PyObject * importAssembly(PyObject *self, PyObject *args) aReader.SetNameMode(true); aReader.SetLayerMode(true); if (aReader.ReadFile((Standard_CString)(name8bit.c_str())) != IFSelect_RetDone) { - PyErr_SetString(PyExc_Exception, "cannot read STEP file"); + PyErr_SetString(PyExc_IOError, "cannot read STEP file"); return 0; } @@ -379,7 +379,7 @@ static PyObject * importAssembly(PyObject *self, PyObject *args) aReader.SetNameMode(true); aReader.SetLayerMode(true); if (aReader.ReadFile((Standard_CString)(name8bit.c_str())) != IFSelect_RetDone) { - PyErr_SetString(PyExc_Exception, "cannot read IGES file"); + PyErr_SetString(PyExc_IOError, "cannot read IGES file"); return 0; } @@ -400,7 +400,7 @@ static PyObject * importAssembly(PyObject *self, PyObject *args) } } else { - PyErr_SetString(PyExc_Exception, "no supported file format"); + PyErr_SetString(PyExc_RuntimeError, "no supported file format"); return 0; } @@ -411,7 +411,7 @@ static PyObject * importAssembly(PyObject *self, PyObject *args) } catch (Standard_Failure) { Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PyExc_Exception, e->GetMessageString()); + PyErr_SetString(PyExc_RuntimeError, e->GetMessageString()); return 0; } PY_CATCH diff --git a/src/Mod/Part/App/Geom2d/Curve2dPyImp.cpp b/src/Mod/Part/App/Geom2d/Curve2dPyImp.cpp index ebdd2572aa..9cf0df749e 100644 --- a/src/Mod/Part/App/Geom2d/Curve2dPyImp.cpp +++ b/src/Mod/Part/App/Geom2d/Curve2dPyImp.cpp @@ -912,10 +912,10 @@ PyObject* Curve2dPy::intersectCC(PyObject *args) } catch (Standard_Failure) { Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PyExc_Exception, e->GetMessageString()); + PyErr_SetString(PyExc_RuntimeError, e->GetMessageString()); return 0; } - PyErr_SetString(PyExc_Exception, "Geometry is not a curve"); + PyErr_SetString(PyExc_TypeError, "Geometry is not a curve"); return 0; } diff --git a/src/Mod/Part/App/GeometryCurvePyImp.cpp b/src/Mod/Part/App/GeometryCurvePyImp.cpp index ce675943bf..0f6fd8a0df 100644 --- a/src/Mod/Part/App/GeometryCurvePyImp.cpp +++ b/src/Mod/Part/App/GeometryCurvePyImp.cpp @@ -754,7 +754,7 @@ PyObject* GeometryCurvePy::intersectCS(PyObject *args) Handle(Geom_Surface) surf = Handle(Geom_Surface)::DownCast(static_cast(p)->getGeometryPtr()->handle()); GeomAPI_IntCS intersector(curve, surf); if (!intersector.IsDone()) { - PyErr_SetString(PyExc_Exception, "Intersection of curve and surface failed"); + PyErr_SetString(PyExc_RuntimeError, "Intersection of curve and surface failed"); return 0; } @@ -777,11 +777,11 @@ PyObject* GeometryCurvePy::intersectCS(PyObject *args) } catch (Standard_Failure) { Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PyExc_Exception, e->GetMessageString()); + PyErr_SetString(PyExc_RuntimeError, e->GetMessageString()); return 0; } - PyErr_SetString(PyExc_Exception, "Geometry is not a curve"); + PyErr_SetString(PyExc_TypeError, "Geometry is not a curve"); return 0; } @@ -815,11 +815,11 @@ PyObject* GeometryCurvePy::intersectCC(PyObject *args) } catch (Standard_Failure) { Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PyExc_Exception, e->GetMessageString()); + PyErr_SetString(PyExc_RuntimeError, e->GetMessageString()); return 0; } - PyErr_SetString(PyExc_Exception, "Geometry is not a curve"); + PyErr_SetString(PyExc_TypeError, "Geometry is not a curve"); return 0; } @@ -846,10 +846,10 @@ PyObject* GeometryCurvePy::intersect(PyObject *args) } catch (Standard_Failure) { Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PyExc_Exception, e->GetMessageString()); + PyErr_SetString(PyExc_RuntimeError, e->GetMessageString()); return 0; } - PyErr_SetString(PyExc_Exception, "Geometry is not a curve"); + PyErr_SetString(PyExc_TypeError, "Geometry is not a curve"); return 0; } diff --git a/src/Mod/Part/App/GeometrySurfacePyImp.cpp b/src/Mod/Part/App/GeometrySurfacePyImp.cpp index 19b5350938..f8ca8b1527 100644 --- a/src/Mod/Part/App/GeometrySurfacePyImp.cpp +++ b/src/Mod/Part/App/GeometrySurfacePyImp.cpp @@ -536,7 +536,7 @@ PyObject* GeometrySurfacePy::intersectSS(PyObject *args) Handle(Geom_Surface) surf2 = Handle(Geom_Surface)::DownCast(static_cast(p)->getGeometryPtr()->handle()); GeomAPI_IntSS intersector(surf1, surf2, prec); if (!intersector.IsDone()) { - PyErr_SetString(PyExc_Exception, "Intersection of surfaces failed"); + PyErr_SetString(PyExc_RuntimeError, "Intersection of surfaces failed"); return 0; } @@ -551,11 +551,11 @@ PyObject* GeometrySurfacePy::intersectSS(PyObject *args) } catch (Standard_Failure) { Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PyExc_Exception, e->GetMessageString()); + PyErr_SetString(PyExc_RuntimeError, e->GetMessageString()); return 0; } - PyErr_SetString(PyExc_Exception, "intersectSS(): Geometry is not a surface"); + PyErr_SetString(PyExc_TypeError, "intersectSS(): Geometry is not a surface"); return 0; } @@ -588,10 +588,10 @@ PyObject* GeometrySurfacePy::intersect(PyObject *args) } catch (Standard_Failure) { Handle(Standard_Failure) e = Standard_Failure::Caught(); - PyErr_SetString(PyExc_Exception, e->GetMessageString()); + PyErr_SetString(PyExc_RuntimeError, e->GetMessageString()); return 0; } - PyErr_SetString(PyExc_Exception, "intersect(): Geometry is not a surface"); + PyErr_SetString(PyExc_TypeError, "intersect(): Geometry is not a surface"); return 0; }