Base: improve exception
For better FC and Python exception mapping.
This commit is contained in:
@@ -194,6 +194,7 @@ Base::ConsoleObserverFile *Application::_pConsoleObserverFile =0;
|
||||
|
||||
AppExport std::map<std::string,std::string> Application::mConfig;
|
||||
BaseExport extern PyObject* Base::BaseExceptionFreeCADError;
|
||||
BaseExport extern PyObject* Base::BaseExceptionFreeCADAbort;
|
||||
|
||||
//**************************************************************************
|
||||
// Construction and destruction
|
||||
@@ -314,6 +315,10 @@ Application::Application(std::map<std::string,std::string> &mConfig)
|
||||
Py_INCREF(Base::BaseExceptionFreeCADError);
|
||||
PyModule_AddObject(pBaseModule, "FreeCADError", Base::BaseExceptionFreeCADError);
|
||||
|
||||
Base::BaseExceptionFreeCADAbort = PyErr_NewException("Base.FreeCADAbort", PyExc_BaseException, NULL);
|
||||
Py_INCREF(Base::BaseExceptionFreeCADAbort);
|
||||
PyModule_AddObject(pBaseModule, "FreeCADAbort", Base::BaseExceptionFreeCADAbort);
|
||||
|
||||
// Python types
|
||||
Base::Interpreter().addType(&Base::VectorPy ::Type,pBaseModule,"Vector");
|
||||
Base::Interpreter().addType(&Base::MatrixPy ::Type,pBaseModule,"Matrix");
|
||||
@@ -1319,6 +1324,7 @@ void Application::initTypes(void)
|
||||
Base::Type ::init();
|
||||
Base::BaseClass ::init();
|
||||
Base::Exception ::init();
|
||||
Base::AbortException ::init();
|
||||
Base::Persistence ::init();
|
||||
|
||||
// Complex data classes
|
||||
@@ -1461,6 +1467,8 @@ void Application::initTypes(void)
|
||||
new ExceptionProducer<Base::TypeError>;
|
||||
new ExceptionProducer<Base::ValueError>;
|
||||
new ExceptionProducer<Base::IndexError>;
|
||||
new ExceptionProducer<Base::NameError>;
|
||||
new ExceptionProducer<Base::ImportError>;
|
||||
new ExceptionProducer<Base::AttributeError>;
|
||||
new ExceptionProducer<Base::RuntimeError>;
|
||||
new ExceptionProducer<Base::BadGraphError>;
|
||||
|
||||
Reference in New Issue
Block a user