Base: [skip ci] add method to more easily set the Python error indicator from a Base::Exception
This commit is contained in:
@@ -28,6 +28,7 @@
|
||||
|
||||
#include "Exception.h"
|
||||
#include "Console.h"
|
||||
#include "PyObjectBase.h"
|
||||
#include <CXX/Objects.hxx>
|
||||
|
||||
FC_LOG_LEVEL_INIT("Exception", true, true)
|
||||
@@ -148,6 +149,21 @@ void Exception::setPyObject( PyObject * pydict)
|
||||
}
|
||||
}
|
||||
|
||||
PyObject * Exception::getPyExceptionType() const
|
||||
{
|
||||
return BaseExceptionFreeCADError;
|
||||
}
|
||||
|
||||
void Exception::setPyException() const
|
||||
{
|
||||
PyObject* exc = getPyExceptionType();
|
||||
if (!exc) {
|
||||
exc = BaseExceptionFreeCADError;
|
||||
}
|
||||
|
||||
PyErr_SetString(exc, what());
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------
|
||||
|
||||
TYPESYSTEM_SOURCE(Base::AbortException,Base::Exception)
|
||||
|
||||
Reference in New Issue
Block a user