fixes #0001422: Subclass Exception

inherit Base.FreeCADError form RuntimeError
inherit Part.OCCError from Base.FreeCADError
inherit OCCDomainError from Part.OCCError
inherit OCCRangeError from Part.OCCError
inherit OCCConstructionError from OCCDomainError
inherit OCCDimensionError from OCCDomainError
Added PY_CATCH_OCC macro
replace PyExc_Exception
use FreeCADError in makeWireString
catch exception in BSplineCurve.increasedegree
This commit is contained in:
Sebastian Hoogen
2014-08-19 11:18:19 +02:00
committed by wmayer
parent 6cd1feb44f
commit af50cbf964
69 changed files with 749 additions and 501 deletions

View File

@@ -62,7 +62,7 @@ static PyObject * read(PyObject *self, PyObject *args)
return new MeshPy(mesh.release());
}
else {
PyErr_SetString(PyExc_Exception, "Loading of mesh was aborted");
PyErr_SetString(Base::BaseExceptionFreeCADError, "Loading of mesh was aborted");
return NULL;
}
} PY_CATCH;
@@ -267,7 +267,7 @@ createSphere(PyObject *self, PyObject *args)
PY_TRY {
MeshObject* mesh = MeshObject::createSphere(radius, sampling);
if (!mesh) {
PyErr_SetString(PyExc_Exception, "Creation of sphere failed");
PyErr_SetString(Base::BaseExceptionFreeCADError, "Creation of sphere failed");
return NULL;
}
return new MeshPy(mesh);
@@ -286,7 +286,7 @@ createEllipsoid(PyObject *self, PyObject *args)
PY_TRY {
MeshObject* mesh = MeshObject::createEllipsoid(radius1, radius2, sampling);
if (!mesh) {
PyErr_SetString(PyExc_Exception, "Creation of ellipsoid failed");
PyErr_SetString(Base::BaseExceptionFreeCADError, "Creation of ellipsoid failed");
return NULL;
}
return new MeshPy(mesh);
@@ -307,7 +307,7 @@ createCylinder(PyObject *self, PyObject *args)
PY_TRY {
MeshObject* mesh = MeshObject::createCylinder(radius, length, closed, edgelen, sampling);
if (!mesh) {
PyErr_SetString(PyExc_Exception, "Creation of cylinder failed");
PyErr_SetString(Base::BaseExceptionFreeCADError, "Creation of cylinder failed");
return NULL;
}
return new MeshPy(mesh);
@@ -329,7 +329,7 @@ createCone(PyObject *self, PyObject *args)
PY_TRY {
MeshObject* mesh = MeshObject::createCone(radius1, radius2, len, closed, edgelen, sampling);
if (!mesh) {
PyErr_SetString(PyExc_Exception, "Creation of cone failed");
PyErr_SetString(Base::BaseExceptionFreeCADError, "Creation of cone failed");
return NULL;
}
return new MeshPy(mesh);
@@ -348,7 +348,7 @@ createTorus(PyObject *self, PyObject *args)
PY_TRY {
MeshObject* mesh = MeshObject::createTorus(radius1, radius2, sampling);
if (!mesh) {
PyErr_SetString(PyExc_Exception, "Creation of torus failed");
PyErr_SetString(Base::BaseExceptionFreeCADError, "Creation of torus failed");
return NULL;
}
return new MeshPy(mesh);
@@ -373,7 +373,7 @@ createBox(PyObject *self, PyObject *args)
mesh = MeshObject::createCube(length, width, height, edgelen);
if (!mesh) {
PyErr_SetString(PyExc_Exception, "Creation of box failed");
PyErr_SetString(Base::BaseExceptionFreeCADError, "Creation of box failed");
return NULL;
}
return new MeshPy(mesh);
@@ -389,7 +389,7 @@ calculateEigenTransform(PyObject *self, PyObject *args)
return NULL;
if(! PySequence_Check(input) ){
PyErr_SetString(PyExc_Exception, "Input have to be a sequence of Base.Vector()");
PyErr_SetString(Base::BaseExceptionFreeCADError, "Input have to be a sequence of Base.Vector()");
return NULL;
}