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 f1dffbb90e
commit 5e51a6cdf7
69 changed files with 749 additions and 501 deletions

View File

@@ -380,7 +380,7 @@ PyObject* Application::sExport(PyObject * /*self*/, PyObject *args,PyObject * /*
Gui::Document* gui_doc = Application::Instance->getDocument(doc);
std::list<MDIView*> view3d = gui_doc->getMDIViewsOfType(View3DInventor::getClassTypeId());
if (view3d.empty()) {
PyErr_SetString(PyExc_Exception, "Cannot export to SVG because document doesn't have a 3d view");
PyErr_SetString(Base::BaseExceptionFreeCADError, "Cannot export to SVG because document doesn't have a 3d view");
return 0;
}
else {
@@ -535,7 +535,7 @@ PyObject* Application::sActivateWorkbenchHandler(PyObject * /*self*/, PyObject *
Instance->activateWorkbench(psKey);
}
catch (const Base::Exception& e) {
PyErr_SetString(PyExc_Exception, e.what());
PyErr_SetString(Base::BaseExceptionFreeCADError, e.what());
return 0;
}
catch (const XERCES_CPP_NAMESPACE_QUALIFIER TranscodingException& e) {
@@ -551,7 +551,7 @@ PyObject* Application::sActivateWorkbenchHandler(PyObject * /*self*/, PyObject *
return 0;
}
catch (...) {
PyErr_SetString(PyExc_Exception, "Unknown C++ exception raised in activateWorkbench");
PyErr_SetString(Base::BaseExceptionFreeCADError, "Unknown C++ exception raised in activateWorkbench");
return 0;
}
@@ -763,7 +763,7 @@ PyObject* Application::sAddIcon(PyObject * /*self*/, PyObject *args,PyObject * /
}
if (icon.isNull()) {
PyErr_SetString(PyExc_Exception, "Invalid icon added to application");
PyErr_SetString(Base::BaseExceptionFreeCADError, "Invalid icon added to application");
return NULL;
}
@@ -813,11 +813,11 @@ PyObject* Application::sAddCommand(PyObject * /*self*/, PyObject *args,PyObject
Application::Instance->commandManager().addCommand(new PythonCommand(pName,pcCmdObj,pSource));
}
catch (const Base::Exception& e) {
PyErr_SetString(PyExc_Exception, e.what());
PyErr_SetString(Base::BaseExceptionFreeCADError, e.what());
return 0;
}
catch (...) {
PyErr_SetString(PyExc_Exception, "Unknown C++ exception raised in Application::sAddCommand()");
PyErr_SetString(Base::BaseExceptionFreeCADError, "Unknown C++ exception raised in Application::sAddCommand()");
return 0;
}
#endif