Merge pull request #21083 from 3x380V/exception-stage-1

Base: simplify Exception
This commit is contained in:
Benjamin Nauck
2025-05-06 09:29:45 +02:00
committed by GitHub
129 changed files with 747 additions and 1481 deletions
+3 -3
View File
@@ -793,7 +793,7 @@ std::vector<Document*> Application::openDocuments(const std::vector<std::string>
_objCount = -1;
}
catch (const Base::Exception &e) {
e.ReportException();
e.reportException();
if (!errs && isMainDoc)
throw;
if (errs && isMainDoc)
@@ -857,7 +857,7 @@ std::vector<Document*> Application::openDocuments(const std::vector<std::string>
try {
docs = Document::getDependentDocuments(docs, true);
} catch (Base::Exception &e) {
e.ReportException();
e.reportException();
}
for(auto it=docs.begin(); it!=docs.end();) {
auto doc = *it;
@@ -2811,7 +2811,7 @@ void Application::initApplication()
Base::Interpreter().runString(Base::ScriptFactory().ProduceScript("FreeCADInit"));
}
catch (const Base::Exception& e) {
e.ReportException();
e.reportException();
}
// seed randomizer
+3 -3
View File
@@ -88,7 +88,7 @@ AutoTransaction::~AutoTransaction()
app.closeActiveTransaction();
}
catch (Base::Exception& e) {
e.ReportException();
e.reportException();
}
catch (...) {
}
@@ -241,11 +241,11 @@ TransactionLocker::~TransactionLocker()
return;
}
catch (Base::Exception& e) {
e.ReportException();
e.reportException();
}
catch (Py::Exception&) {
Base::PyException e;
e.ReportException();
e.reportException();
}
catch (std::exception& e) {
FC_ERR(e.what());
+1 -1
View File
@@ -624,7 +624,7 @@ void ComplexGeoData::restoreStream(std::istream& stream, std::size_t count)
}
}
catch (Base::Exception& e) {
e.ReportException();
e.reportException();
_restoreFailed = true;
_elementMap.reset();
}
+1 -1
View File
@@ -388,7 +388,7 @@ bool LocalCoordinateSystem::extensionGetSubObject(DocumentObject*& ret,
return true;
}
catch (const Base::Exception& e) {
e.ReportException();
e.reportException();
return false;
}
}
+9 -9
View File
@@ -1557,19 +1557,19 @@ std::vector<App::DocumentObject*> Document::readObjects(Base::XMLReader& reader)
// Try to continue only for certain exception types if not handled
// by the feature type. For all other exception types abort the process.
catch (const Base::UnicodeError& e) {
e.ReportException();
e.reportException();
}
catch (const Base::ValueError& e) {
e.ReportException();
e.reportException();
}
catch (const Base::IndexError& e) {
e.ReportException();
e.reportException();
}
catch (const Base::RuntimeError& e) {
e.ReportException();
e.reportException();
}
catch (const Base::XMLAttributeError& e) {
e.ReportException();
e.reportException();
}
pObj->setStatus(ObjectStatus::Restore, false);
@@ -3077,7 +3077,7 @@ int Document::recompute(const std::vector<App::DocumentObject*>& objs,
}
}
catch (Base::Exception& e) {
e.ReportException();
e.reportException();
}
FC_TIME_LOG(t2, "Recompute");
@@ -3117,7 +3117,7 @@ int Document::recompute(const std::vector<App::DocumentObject*>& objs,
}
}
catch (Base::Exception& e) {
e.ReportException();
e.reportException();
FC_ERR("error when removing object " << o.getDocumentName() << '#'
<< o.getObjectName());
}
@@ -3326,7 +3326,7 @@ int Document::_recomputeFeature(DocumentObject* Feat)
}
}
catch (Base::AbortException& e) {
e.ReportException();
e.reportException();
FC_LOG("Failed to recompute " << Feat->getFullName() << ": " << e.what());
d->addRecomputeLog("User abort", Feat);
return -1;
@@ -3337,7 +3337,7 @@ int Document::_recomputeFeature(DocumentObject* Feat)
return 1;
}
catch (Base::Exception& e) {
e.ReportException();
e.reportException();
FC_LOG("Failed to recompute " << Feat->getFullName() << ": " << e.what());
d->addRecomputeLog(e.what(), Feat);
return 1;
+1 -1
View File
@@ -148,7 +148,7 @@ void DocumentObject::printInvalidLinks() const
scopenames.c_str());
}
catch (const Base::Exception& e) {
e.ReportException();
e.reportException();
}
}
+29 -29
View File
@@ -133,7 +133,7 @@ void DocumentObserverPython::slotCreatedDocument(const App::Document& Doc)
}
catch (Py::Exception&) {
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
}
@@ -147,7 +147,7 @@ void DocumentObserverPython::slotDeletedDocument(const App::Document& Doc)
}
catch (Py::Exception&) {
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
}
@@ -161,7 +161,7 @@ void DocumentObserverPython::slotRelabelDocument(const App::Document& Doc)
}
catch (Py::Exception&) {
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
}
@@ -175,7 +175,7 @@ void DocumentObserverPython::slotActivateDocument(const App::Document& Doc)
}
catch (Py::Exception&) {
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
}
@@ -189,7 +189,7 @@ void DocumentObserverPython::slotUndoDocument(const App::Document& Doc)
}
catch (Py::Exception&) {
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
}
@@ -204,7 +204,7 @@ void DocumentObserverPython::slotRedoDocument(const App::Document& Doc)
}
catch (Py::Exception&) {
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
}
@@ -216,7 +216,7 @@ void DocumentObserverPython::slotUndo()
}
catch (Py::Exception&) {
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
}
@@ -228,7 +228,7 @@ void DocumentObserverPython::slotRedo()
}
catch (Py::Exception&) {
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
}
@@ -242,7 +242,7 @@ void DocumentObserverPython::slotBeforeCloseTransaction(bool abort)
}
catch (Py::Exception&) {
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
}
@@ -256,7 +256,7 @@ void DocumentObserverPython::slotCloseTransaction(bool abort)
}
catch (Py::Exception&) {
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
}
@@ -277,7 +277,7 @@ void DocumentObserverPython::slotBeforeChangeDocument(const App::Document& Doc,
}
catch (Py::Exception&) {
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
}
@@ -298,7 +298,7 @@ void DocumentObserverPython::slotChangedDocument(const App::Document& Doc,
}
catch (Py::Exception&) {
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
}
@@ -312,7 +312,7 @@ void DocumentObserverPython::slotCreatedObject(const App::DocumentObject& Obj)
}
catch (Py::Exception&) {
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
}
@@ -326,7 +326,7 @@ void DocumentObserverPython::slotDeletedObject(const App::DocumentObject& Obj)
}
catch (Py::Exception&) {
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
}
@@ -347,7 +347,7 @@ void DocumentObserverPython::slotBeforeChangeObject(const App::DocumentObject& O
}
catch (Py::Exception&) {
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
}
@@ -368,7 +368,7 @@ void DocumentObserverPython::slotChangedObject(const App::DocumentObject& Obj,
}
catch (Py::Exception&) {
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
}
@@ -382,7 +382,7 @@ void DocumentObserverPython::slotRecomputedObject(const App::DocumentObject& Obj
}
catch (Py::Exception&) {
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
}
@@ -396,7 +396,7 @@ void DocumentObserverPython::slotRecomputedDocument(const App::Document& doc)
}
catch (Py::Exception&) {
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
}
@@ -410,7 +410,7 @@ void DocumentObserverPython::slotBeforeRecomputeDocument(const App::Document& do
}
catch (Py::Exception&) {
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
}
@@ -425,7 +425,7 @@ void DocumentObserverPython::slotOpenTransaction(const App::Document& doc, std::
}
catch (Py::Exception&) {
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
}
@@ -439,7 +439,7 @@ void DocumentObserverPython::slotCommitTransaction(const App::Document& doc)
}
catch (Py::Exception&) {
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
}
@@ -453,7 +453,7 @@ void DocumentObserverPython::slotAbortTransaction(const App::Document& doc)
}
catch (Py::Exception&) {
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
}
@@ -474,7 +474,7 @@ void DocumentObserverPython::slotAppendDynamicProperty(const App::Property& Prop
}
catch (Py::Exception&) {
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
}
@@ -495,7 +495,7 @@ void DocumentObserverPython::slotRemoveDynamicProperty(const App::Property& Prop
}
catch (Py::Exception&) {
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
}
@@ -517,7 +517,7 @@ void DocumentObserverPython::slotChangePropertyEditor(const App::Document&,
}
catch (Py::Exception&) {
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
}
@@ -533,7 +533,7 @@ void DocumentObserverPython::slotStartSaveDocument(const App::Document& doc,
}
catch (Py::Exception&) {
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
}
@@ -549,7 +549,7 @@ void DocumentObserverPython::slotFinishSaveDocument(const App::Document& doc,
}
catch (Py::Exception&) {
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
}
@@ -566,7 +566,7 @@ void DocumentObserverPython::slotBeforeAddingDynamicExtension(
}
catch (Py::Exception&) {
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
}
@@ -582,6 +582,6 @@ void DocumentObserverPython::slotAddedDynamicExtension(const App::ExtensionConta
}
catch (Py::Exception&) {
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
}
+1 -1
View File
@@ -381,7 +381,7 @@ PyObject* DocumentPy::addObject(PyObject* args, PyObject* kwd)
}
catch (Py::Exception&) {
Base::PyException e;
e.ReportException();
e.reportException();
}
}
+1 -1
View File
@@ -619,7 +619,7 @@ bool isAnyEqual(const App::any &v1, const App::any &v2) {
return false;
int res = PyObject_RichCompareBool(o1.ptr(),o2.ptr(),Py_EQ);
if(res<0)
PyException::ThrowException();
PyException::throwException();
return !!res;
}
+1 -1
View File
@@ -87,7 +87,7 @@ using ExtensionPython = ExtensionPythonT<App::Extension>;
catch (Py::Exception&) \
{ \
Base::PyException e; \
e.ReportException(); \
e.reportException(); \
}
#define EXTENSION_PROXY_NOARG(function) \
+19 -19
View File
@@ -99,7 +99,7 @@ bool FeaturePythonImp::execute()
PyErr_Clear();
return false;
}
Base::PyException::ThrowException(); // extract the Python error text
Base::PyException::throwException(); // extract the Python error text
}
return false;
@@ -123,7 +123,7 @@ bool FeaturePythonImp::mustExecute() const
}
catch (Py::Exception&) {
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
return false;
}
@@ -156,7 +156,7 @@ void FeaturePythonImp::onBeforeChange(const Property* prop)
}
catch (Py::Exception&) {
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
}
@@ -183,7 +183,7 @@ bool FeaturePythonImp::onBeforeChangeLabel(std::string& newLabel)
}
catch (Py::Exception&) {
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
return false;
}
@@ -214,7 +214,7 @@ void FeaturePythonImp::onChanged(const Property* prop)
}
catch (Py::Exception&) {
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
}
@@ -236,7 +236,7 @@ void FeaturePythonImp::onDocumentRestored()
}
catch (Py::Exception&) {
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
}
@@ -258,7 +258,7 @@ void FeaturePythonImp::unsetupObject()
}
catch (Py::Exception&) {
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
}
@@ -330,7 +330,7 @@ bool FeaturePythonImp::getSubObject(DocumentObject*& ret,
return false;
}
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
ret = nullptr;
return true;
}
@@ -367,7 +367,7 @@ bool FeaturePythonImp::getSubObjects(std::vector<std::string>& ret, int reason)
return false;
}
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
return true;
}
}
@@ -424,7 +424,7 @@ bool FeaturePythonImp::getLinkedObject(DocumentObject*& ret,
return false;
}
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
ret = nullptr;
return true;
}
@@ -453,7 +453,7 @@ FeaturePythonImp::ValueT FeaturePythonImp::hasChildElement() const
}
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
return Rejected;
}
}
@@ -474,7 +474,7 @@ int FeaturePythonImp::isElementVisible(const char* element) const
return -2;
}
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
return -1;
}
}
@@ -496,7 +496,7 @@ int FeaturePythonImp::setElementVisible(const char* element, bool visible)
return -2;
}
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
return -1;
}
}
@@ -512,7 +512,7 @@ std::string FeaturePythonImp::getViewProviderName()
}
catch (Py::Exception&) {
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
return {};
@@ -534,7 +534,7 @@ FeaturePythonImp::ValueT FeaturePythonImp::canLinkProperties() const
return NotImplemented;
}
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
return Rejected;
}
}
@@ -556,7 +556,7 @@ FeaturePythonImp::ValueT FeaturePythonImp::allowDuplicateLabel() const
}
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
return Rejected;
}
}
@@ -577,7 +577,7 @@ int FeaturePythonImp::canLoadPartial() const
return -1;
}
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
return 0;
}
}
@@ -609,7 +609,7 @@ FeaturePythonImp::ValueT FeaturePythonImp::redirectSubName(std::ostringstream& s
}
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
return Rejected;
}
}
@@ -631,7 +631,7 @@ bool FeaturePythonImp::editProperty(const char* name)
}
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
return false;
}
+1 -1
View File
@@ -236,7 +236,7 @@ bool GroupExtension::hasObject(const DocumentObject* obj, bool recursive) const
return false;
}
catch (const Base::RuntimeError& e) {
e.ReportException();
e.reportException();
return false;
}
}
+4 -4
View File
@@ -429,11 +429,11 @@ App::DocumentObjectExecReturn* LinkBaseExtension::extensionExecute()
}
catch (Py::Exception&) {
Base::PyException e;
e.ReportException();
e.reportException();
return new App::DocumentObjectExecReturn(errMsg);
}
catch (Base::Exception& e) {
e.ReportException();
e.reportException();
return new App::DocumentObjectExecReturn(errMsg);
}
}
@@ -451,7 +451,7 @@ App::DocumentObjectExecReturn* LinkBaseExtension::extensionExecute()
parent->removeDynamicProperty(prop->getName());
}
catch (Base::Exception& e) {
e.ReportException();
e.reportException();
}
catch (...) {
}
@@ -538,7 +538,7 @@ void LinkBaseExtension::setOnChangeCopyObject(App::DocumentObject* obj, OnChange
obj->addDynamicProperty("App::PropertyMap", "_CopyOnChangeControl"));
}
catch (Base::Exception& e) {
e.ReportException();
e.reportException();
}
if (!prop) {
FC_ERR("Failed to setup copy on change object " << obj->getFullName());
+2 -2
View File
@@ -186,7 +186,7 @@ std::vector<MeasureType*> MeasureManager::getValidMeasureTypes(App::MeasureSelec
}
catch (const Py::Exception&) {
Base::PyException e;
e.ReportException();
e.reportException();
isValid = Py::False();
}
@@ -199,7 +199,7 @@ std::vector<MeasureType*> MeasureManager::getValidMeasureTypes(App::MeasureSelec
}
catch (const Py::Exception&) {
Base::PyException e;
e.ReportException();
e.reportException();
isPriority = Py::False();
}
+9 -9
View File
@@ -711,12 +711,12 @@ Py::Object ObjectIdentifier::Component::get(const Py::Object& pyobj) const
true);
PyObject* r = PyObject_GetItem(pyobj.ptr(), slice.ptr());
if (!r) {
Base::PyException::ThrowException();
Base::PyException::throwException();
}
res = Py::asObject(r);
}
if (!res.ptr()) {
Base::PyException::ThrowException();
Base::PyException::throwException();
}
if (PyModule_Check(res.ptr()) && !ExpressionParser::isModuleImported(res.ptr())) {
FC_THROWM(Base::RuntimeError, "Module '" << getName() << "' access denied.");
@@ -728,7 +728,7 @@ void ObjectIdentifier::Component::set(Py::Object& pyobj, const Py::Object& value
{
if (isSimple()) {
if (PyObject_SetAttrString(*pyobj, getName().c_str(), *value) == -1) {
Base::PyException::ThrowException();
Base::PyException::throwException();
}
}
else if (isArray()) {
@@ -750,7 +750,7 @@ void ObjectIdentifier::Component::set(Py::Object& pyobj, const Py::Object& value
step != 1 ? Py::Long(step).ptr() : nullptr),
true);
if (PyObject_SetItem(pyobj.ptr(), slice.ptr(), value.ptr()) < 0) {
Base::PyException::ThrowException();
Base::PyException::throwException();
}
}
}
@@ -779,7 +779,7 @@ void ObjectIdentifier::Component::del(Py::Object& pyobj) const
step != 1 ? Py::Long(step).ptr() : nullptr),
true);
if (PyObject_DelItem(pyobj.ptr(), slice.ptr()) < 0) {
Base::PyException::ThrowException();
Base::PyException::throwException();
}
}
}
@@ -1714,7 +1714,7 @@ ObjectIdentifier::access(const ResolveResults& result, Py::Object* value, Depend
if (!pymod) { \
pymod = PyImport_ImportModule(#_name); \
if (!pymod) \
Base::PyException::ThrowException(); \
Base::PyException::throwException(); \
else \
Py_DECREF(pymod); \
} \
@@ -1959,7 +1959,7 @@ App::any ObjectIdentifier::getValue(bool pathValue, bool* isPseudoProperty) cons
return pyObjectToAny(access(rs));
}
catch (Py::Exception&) {
Base::PyException::ThrowException();
Base::PyException::throwException();
}
return {};
}
@@ -1988,7 +1988,7 @@ Py::Object ObjectIdentifier::getPyValue(bool pathValue, bool* isPseudoProperty)
return access(rs);
}
catch (Py::Exception&) {
Base::PyException::ThrowException();
Base::PyException::throwException();
}
return Py::Object();
}
@@ -2017,7 +2017,7 @@ void ObjectIdentifier::setValue(const App::any& value) const
access(rs, &pyvalue);
}
catch (Py::Exception&) {
Base::PyException::ThrowException();
Base::PyException::throwException();
}
}
+1 -1
View File
@@ -460,7 +460,7 @@ public:
mProp.hasSetValue();
}
catch (Base::Exception& e) {
e.ReportException();
e.reportException();
}
catch (...) {
}
+1 -1
View File
@@ -246,7 +246,7 @@ void PropertyExpressionEngine::updateHiddenReference(const std::string& key)
}
}
catch (Base::Exception& e) {
e.ReportException();
e.reportException();
FC_ERR("Failed to evaluate property binding " << myProp->getFullName()
<< " on change of " << key);
}
+2 -2
View File
@@ -288,7 +288,7 @@ void PropertyLinkBase::updateElementReferences(DocumentObject* feature, bool rev
prop->updateElementReference(feature, reverse, true);
}
catch (Base::Exception& e) {
e.ReportException();
e.reportException();
FC_ERR("Failed to update element reference of " << propertyName(prop));
}
catch (std::exception& e) {
@@ -5849,7 +5849,7 @@ void PropertyXLinkContainer::_onBreakLink(DocumentObject* obj)
onBreakLink(obj);
}
catch (Base::Exception& e) {
e.ReportException();
e.reportException();
FC_ERR("Exception on breaking link property " << getFullName());
}
catch (std::exception& e) {
+5 -5
View File
@@ -125,7 +125,7 @@ std::string PropertyPythonObject::toString() const
Base::Console().Error("PropertyPythonObject::toString(): failed for %s\n",
typestr.as_string().c_str());
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
return repr;
@@ -175,7 +175,7 @@ void PropertyPythonObject::fromString(const std::string& repr)
}
catch (Py::Exception&) {
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
}
@@ -201,7 +201,7 @@ void PropertyPythonObject::loadPickle(const std::string& str)
}
catch (Py::Exception&) {
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
}
@@ -324,7 +324,7 @@ void PropertyPythonObject::Save(Base::Writer& writer) const
}
catch (Py::Exception&) {
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
saveObject(writer);
@@ -394,7 +394,7 @@ void PropertyPythonObject::Restore(Base::XMLReader& reader)
}
catch (Py::Exception&) {
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
this->object = Py::None();
load_failed = true;
}
+1 -1
View File
@@ -518,7 +518,7 @@ void PropertyEnumeration::setPyObject(PyObject* value)
}
catch (Py::Exception&) {
Base::PyException e;
e.ReportException();
e.reportException();
}
}
+1 -1
View File
@@ -813,7 +813,7 @@ void StringHasher::Restore(Base::XMLReader& reader)
restoreStreamNew(reader.beginCharStream(), count);
}
catch (const Base::Exception& e) {
e.ReportException();
e.reportException();
FC_ERR("Failed to restore string table: full-document recompute strongly recommended.");
}
reader.readEndElement("StringHasher2");
+2 -2
View File
@@ -187,7 +187,7 @@ void Transaction::apply(Document& Doc, bool forward)
}
}
catch (Base::Exception& e) {
e.ReportException();
e.reportException();
errMsg = e.what();
}
catch (std::exception& e) {
@@ -368,7 +368,7 @@ void TransactionObject::applyChn(Document& /*Doc*/, TransactionalObject* pcObj,
prop->Paste(*data.property);
}
catch (Base::Exception& e) {
e.ReportException();
e.reportException();
FC_ERR("exception while restoring " << prop->getFullName() << ": " << e.what());
}
catch (std::exception& e) {
+139 -402
View File
@@ -21,13 +21,15 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#include <utility>
#endif
#include "Exception.h"
#include "Console.h"
#include "PyObjectBase.h"
#include "Exception.h"
FC_LOG_LEVEL_INIT("Exception", true, true)
@@ -35,120 +37,96 @@ using namespace Base;
TYPESYSTEM_SOURCE(Base::Exception, Base::BaseClass)
Exception::Exception()
: _sErrMsg("FreeCAD Exception")
, _line(0)
, _isTranslatable(false)
, _isReported(false)
Exception::Exception(std::string message)
: errorMessage {std::move(message)}
{}
Exception::Exception(const Exception& inst) = default;
Exception::Exception(Exception&& inst) noexcept = default;
Exception::Exception(const char* sMessage)
: _sErrMsg(sMessage)
, _line(0)
, _isTranslatable(false)
, _isReported(false)
{}
Exception::Exception(std::string sMessage)
: _sErrMsg(std::move(sMessage))
, _line(0)
, _isTranslatable(false)
, _isReported(false)
{}
Exception& Exception::operator=(const Exception& inst)
{
_sErrMsg = inst._sErrMsg;
_file = inst._file;
_line = inst._line;
_function = inst._function;
_isTranslatable = inst._isTranslatable;
errorMessage = inst.errorMessage;
fileName = inst.fileName;
lineNum = inst.lineNum;
functionName = inst.functionName;
isTranslatable = inst.isTranslatable;
return *this;
}
Exception& Exception::operator=(Exception&& inst) noexcept
{
_sErrMsg = std::move(inst._sErrMsg);
_file = std::move(inst._file);
_line = inst._line;
_function = std::move(inst._function);
_isTranslatable = inst._isTranslatable;
errorMessage = std::move(inst.errorMessage);
fileName = std::move(inst.fileName);
lineNum = inst.lineNum;
functionName = std::move(inst.functionName);
isTranslatable = inst.isTranslatable;
return *this;
}
const char* Exception::what() const noexcept
{
return _sErrMsg.c_str();
return errorMessage.c_str();
}
void Exception::ReportException() const
void Exception::reportException() const
{
if (!_isReported) {
const char* msg {};
if (_sErrMsg.empty()) {
msg = typeid(*this).name();
}
else {
msg = _sErrMsg.c_str();
}
#ifdef FC_DEBUG
if (!_function.empty()) {
_FC_ERR(_file.c_str(), _line, _function << " -- " << msg);
}
else
#endif
{
_FC_ERR(_file.c_str(), _line, msg);
}
_isReported = true;
if (hasBeenReported) {
return;
}
std::string msg = errorMessage.empty() ? typeid(*this).name() : errorMessage;
#ifdef FC_DEBUG
if (!functionName.empty()) {
msg = functionName + " -- " + msg;
}
#endif
_FC_ERR(fileName.c_str(), lineNum, msg);
hasBeenReported = true;
}
PyObject* Exception::getPyObject()
{
Py::Dict edict;
edict.setItem("sclassname", Py::String(typeid(*this).name()));
edict.setItem("sErrMsg", Py::String(this->getMessage()));
edict.setItem("sfile", Py::String(this->getFile()));
edict.setItem("iline", Py::Long(this->getLine()));
edict.setItem("sfunction", Py::String(this->getFunction()));
edict.setItem("swhat", Py::String(this->what()));
edict.setItem("btranslatable", Py::Boolean(this->getTranslatable()));
edict.setItem("breported", Py::Boolean(this->_isReported));
return Py::new_reference_to(edict);
edict.setItem("sErrMsg", Py::String(getMessage()));
edict.setItem("sfile", Py::String(getFile()));
edict.setItem("iline", Py::Long(getLine()));
edict.setItem("sfunction", Py::String(getFunction()));
edict.setItem("swhat", Py::String(what()));
edict.setItem("btranslatable", Py::Boolean(getTranslatable()));
edict.setItem("breported", Py::Boolean(hasBeenReported));
return new_reference_to(edict);
}
void Exception::setPyObject(PyObject* pydict)
{
try {
if (pydict && Py::_Dict_Check(pydict)) {
Py::Dict edict(pydict);
const Py::Dict edict(pydict);
if (edict.hasKey("sfile")) {
_file = static_cast<std::string>(Py::String(edict.getItem("sfile")));
fileName = Py::String(edict.getItem("sfile"));
}
if (edict.hasKey("sfunction")) {
_function = static_cast<std::string>(Py::String(edict.getItem("sfunction")));
functionName = Py::String(edict.getItem("sfunction"));
}
if (edict.hasKey("sErrMsg")) {
_sErrMsg = static_cast<std::string>(Py::String(edict.getItem("sErrMsg")));
errorMessage = Py::String(edict.getItem("sErrMsg"));
}
if (edict.hasKey("iline")) {
_line = static_cast<long>(Py::Long(edict.getItem("iline")));
lineNum = static_cast<int>(Py::Long(edict.getItem("iline")));
}
if (edict.hasKey("btranslatable")) {
_isTranslatable = static_cast<bool>(Py::Boolean(edict.getItem("btranslatable")));
isTranslatable = static_cast<bool>(Py::Boolean(edict.getItem("btranslatable")));
}
if (edict.hasKey("breported")) {
_isReported = static_cast<bool>(Py::Boolean(edict.getItem("breported")));
hasBeenReported = static_cast<bool>(Py::Boolean(edict.getItem("breported")));
}
}
}
@@ -176,15 +154,10 @@ void Exception::setPyException() const
TYPESYSTEM_SOURCE(Base::AbortException, Base::Exception)
AbortException::AbortException(const char* sMessage)
: Exception(sMessage)
AbortException::AbortException(const std::string& message)
: Exception(message)
{}
AbortException::AbortException()
{
_sErrMsg = "Aborted operation";
}
const char* AbortException::what() const noexcept
{
return Exception::what();
@@ -197,15 +170,8 @@ PyObject* AbortException::getPyExceptionType() const
// ---------------------------------------------------------
XMLBaseException::XMLBaseException() = default;
XMLBaseException::XMLBaseException(const char* sMessage)
: Exception(sMessage)
{}
XMLBaseException::XMLBaseException(const std::string& sMessage)
: Exception(sMessage)
XMLBaseException::XMLBaseException(const std::string& message)
: Exception(message)
{}
PyObject* XMLBaseException::getPyExceptionType() const
@@ -215,19 +181,10 @@ PyObject* XMLBaseException::getPyExceptionType() const
// ---------------------------------------------------------
XMLParseException::XMLParseException(const char* sMessage)
: XMLBaseException(sMessage)
XMLParseException::XMLParseException(const std::string& message)
: XMLBaseException(message)
{}
XMLParseException::XMLParseException(const std::string& sMessage)
: XMLBaseException(sMessage)
{}
XMLParseException::XMLParseException()
{
_sErrMsg = "XML parse exception";
}
const char* XMLParseException::what() const noexcept
{
return XMLBaseException::what();
@@ -240,19 +197,10 @@ PyObject* XMLParseException::getPyExceptionType() const
// ---------------------------------------------------------
XMLAttributeError::XMLAttributeError(const char* sMessage)
: XMLBaseException(sMessage)
XMLAttributeError::XMLAttributeError(const std::string& message)
: XMLBaseException(message)
{}
XMLAttributeError::XMLAttributeError(const std::string& sMessage)
: XMLBaseException(sMessage)
{}
XMLAttributeError::XMLAttributeError()
{
_sErrMsg = "XML attribute error";
}
const char* XMLAttributeError::what() const noexcept
{
return XMLBaseException::what();
@@ -265,33 +213,27 @@ PyObject* XMLAttributeError::getPyExceptionType() const
// ---------------------------------------------------------
FileException::FileException(const char* sMessage, const char* sFileName)
: Exception(sMessage)
, file(sFileName)
FileException::FileException(const std::string& message, const std::string& fileName)
: Exception(message)
, file(fileName)
{
setFileName(sFileName);
setFileName(fileName);
}
FileException::FileException(const char* sMessage, const FileInfo& File)
: Exception(sMessage)
FileException::FileException(const std::string& message, const FileInfo& File)
: Exception(message)
, file(File)
{
setFileName(File.filePath().c_str());
setFileName(File.filePath());
}
FileException::FileException()
: Exception("Unknown file exception happened")
, _sErrMsgAndFileName(_sErrMsg)
{}
void FileException::setFileName(const char* sFileName)
void FileException::setFileName(const std::string& fileName)
{
file.setFile(sFileName);
_sErrMsgAndFileName = _sErrMsg;
if (sFileName) {
file.setFile(fileName);
_sErrMsgAndFileName = getMessage();
if (!getFile().empty()) {
_sErrMsgAndFileName += ": ";
_sErrMsgAndFileName += sFileName;
_sErrMsgAndFileName += fileName;
}
}
@@ -305,34 +247,28 @@ const char* FileException::what() const noexcept
return _sErrMsgAndFileName.c_str();
}
void FileException::ReportException() const
void FileException::reportException() const
{
if (!_isReported) {
const char* msg {};
if (_sErrMsgAndFileName.empty()) {
msg = typeid(*this).name();
}
else {
msg = _sErrMsgAndFileName.c_str();
}
#ifdef FC_DEBUG
if (!_function.empty()) {
_FC_ERR(_file.c_str(), _line, _function << " -- " << msg);
}
else
#endif
{
_FC_ERR(_file.c_str(), _line, msg);
}
_isReported = true;
if (getReported()) {
return;
}
std::string msg = _sErrMsgAndFileName.empty() ? typeid(*this).name() : _sErrMsgAndFileName;
#ifdef FC_DEBUG
if (!getFunction().empty()) {
msg = getFunction() + " -- " + msg;
}
#endif
_FC_ERR(getFile().c_str(), getLine(), msg);
setReported(true);
}
PyObject* FileException::getPyObject()
{
Py::Dict edict(Exception::getPyObject(), true);
edict.setItem("filename", Py::String(this->file.fileName()));
return Py::new_reference_to(edict);
return new_reference_to(edict);
}
void FileException::setPyObject(PyObject* pydict)
@@ -340,9 +276,8 @@ void FileException::setPyObject(PyObject* pydict)
if (pydict) {
Exception::setPyObject(pydict);
Py::Dict edict(pydict);
if (edict.hasKey("filename")) {
setFileName(Py::String(edict.getItem("filename")).as_std_string("utf-8").c_str());
if (const Py::Dict edict(pydict); edict.hasKey("filename")) {
setFileName(Py::String(edict.getItem("filename")).as_std_string("utf-8"));
}
}
}
@@ -354,15 +289,8 @@ PyObject* FileException::getPyExceptionType() const
// ---------------------------------------------------------
FileSystemError::FileSystemError() = default;
FileSystemError::FileSystemError(const char* sMessage)
: Exception(sMessage)
{}
FileSystemError::FileSystemError(const std::string& sMessage)
: Exception(sMessage)
FileSystemError::FileSystemError(const std::string& message)
: Exception(message)
{}
PyObject* FileSystemError::getPyExceptionType() const
@@ -372,15 +300,8 @@ PyObject* FileSystemError::getPyExceptionType() const
// ---------------------------------------------------------
BadFormatError::BadFormatError() = default;
BadFormatError::BadFormatError(const char* sMessage)
: Exception(sMessage)
{}
BadFormatError::BadFormatError(const std::string& sMessage)
: Exception(sMessage)
BadFormatError::BadFormatError(const std::string& message)
: Exception(message)
{}
PyObject* BadFormatError::getPyExceptionType() const
@@ -390,47 +311,14 @@ PyObject* BadFormatError::getPyExceptionType() const
// ---------------------------------------------------------
MemoryException::MemoryException()
{
_sErrMsg = "Not enough memory available";
}
MemoryException::MemoryException(const MemoryException& inst)
#if defined(__GNUC__)
: std::bad_alloc()
, Exception(inst)
#else
: Exception(inst)
#endif
MemoryException::MemoryException(const std::string& message)
: Exception(message) // NOLINT(*-throw-keyword-missing)
{}
MemoryException::MemoryException(MemoryException&& inst) noexcept
#if defined(__GNUC__)
: std::bad_alloc()
, Exception(inst)
#else
: Exception(inst)
#endif
{}
MemoryException& MemoryException::operator=(const MemoryException& inst)
{
Exception::operator=(inst);
return *this;
}
MemoryException& MemoryException::operator=(MemoryException&& inst) noexcept
{
Exception::operator=(inst);
return *this;
}
#if defined(__GNUC__)
const char* MemoryException::what() const noexcept
{
// call what() of Exception, not of std::bad_alloc
return Exception::what();
return Exception::what(); // from Exception, not std::bad_alloc
}
#endif
@@ -441,17 +329,8 @@ PyObject* MemoryException::getPyExceptionType() const
// ---------------------------------------------------------
AccessViolation::AccessViolation()
{
_sErrMsg = "Access violation";
}
AccessViolation::AccessViolation(const char* sMessage)
: Exception(sMessage)
{}
AccessViolation::AccessViolation(const std::string& sMessage)
: Exception(sMessage)
AccessViolation::AccessViolation(const std::string& message)
: Exception(message)
{}
PyObject* AccessViolation::getPyExceptionType() const
@@ -461,17 +340,8 @@ PyObject* AccessViolation::getPyExceptionType() const
// ---------------------------------------------------------
AbnormalProgramTermination::AbnormalProgramTermination()
{
_sErrMsg = "Abnormal program termination";
}
AbnormalProgramTermination::AbnormalProgramTermination(const char* sMessage)
: Exception(sMessage)
{}
AbnormalProgramTermination::AbnormalProgramTermination(const std::string& sMessage)
: Exception(sMessage)
AbnormalProgramTermination::AbnormalProgramTermination(const std::string& message)
: Exception(message)
{}
PyObject* AbnormalProgramTermination::getPyExceptionType() const
@@ -481,14 +351,8 @@ PyObject* AbnormalProgramTermination::getPyExceptionType() const
// ---------------------------------------------------------
UnknownProgramOption::UnknownProgramOption() = default;
UnknownProgramOption::UnknownProgramOption(const char* sMessage)
: Exception(sMessage)
{}
UnknownProgramOption::UnknownProgramOption(const std::string& sMessage)
: Exception(sMessage)
UnknownProgramOption::UnknownProgramOption(const std::string& message)
: Exception(message)
{}
PyObject* UnknownProgramOption::getPyExceptionType() const
@@ -498,26 +362,14 @@ PyObject* UnknownProgramOption::getPyExceptionType() const
// ---------------------------------------------------------
ProgramInformation::ProgramInformation() = default;
ProgramInformation::ProgramInformation(const char* sMessage)
: Exception(sMessage)
{}
ProgramInformation::ProgramInformation(const std::string& sMessage)
: Exception(sMessage)
ProgramInformation::ProgramInformation(const std::string& message)
: Exception(message)
{}
// ---------------------------------------------------------
TypeError::TypeError() = default;
TypeError::TypeError(const char* sMessage)
: Exception(sMessage)
{}
TypeError::TypeError(const std::string& sMessage)
: Exception(sMessage)
TypeError::TypeError(const std::string& message)
: Exception(message)
{}
PyObject* TypeError::getPyExceptionType() const
@@ -527,14 +379,8 @@ PyObject* TypeError::getPyExceptionType() const
// ---------------------------------------------------------
ValueError::ValueError() = default;
ValueError::ValueError(const char* sMessage)
: Exception(sMessage)
{}
ValueError::ValueError(const std::string& sMessage)
: Exception(sMessage)
ValueError::ValueError(const std::string& message)
: Exception(message)
{}
PyObject* ValueError::getPyExceptionType() const
@@ -544,14 +390,8 @@ PyObject* ValueError::getPyExceptionType() const
// ---------------------------------------------------------
IndexError::IndexError() = default;
IndexError::IndexError(const char* sMessage)
: Exception(sMessage)
{}
IndexError::IndexError(const std::string& sMessage)
: Exception(sMessage)
IndexError::IndexError(const std::string& message)
: Exception(message)
{}
PyObject* IndexError::getPyExceptionType() const
@@ -561,14 +401,8 @@ PyObject* IndexError::getPyExceptionType() const
// ---------------------------------------------------------
NameError::NameError() = default;
NameError::NameError(const char* sMessage)
: Exception(sMessage)
{}
NameError::NameError(const std::string& sMessage)
: Exception(sMessage)
NameError::NameError(const std::string& message)
: Exception(message)
{}
PyObject* NameError::getPyExceptionType() const
@@ -578,14 +412,8 @@ PyObject* NameError::getPyExceptionType() const
// ---------------------------------------------------------
ImportError::ImportError() = default;
ImportError::ImportError(const char* sMessage)
: Exception(sMessage)
{}
ImportError::ImportError(const std::string& sMessage)
: Exception(sMessage)
ImportError::ImportError(const std::string& message)
: Exception(message)
{}
PyObject* ImportError::getPyExceptionType() const
@@ -595,14 +423,8 @@ PyObject* ImportError::getPyExceptionType() const
// ---------------------------------------------------------
AttributeError::AttributeError() = default;
AttributeError::AttributeError(const char* sMessage)
: Exception(sMessage)
{}
AttributeError::AttributeError(const std::string& sMessage)
: Exception(sMessage)
AttributeError::AttributeError(const std::string& message)
: Exception(message)
{}
PyObject* AttributeError::getPyExceptionType() const
@@ -612,14 +434,8 @@ PyObject* AttributeError::getPyExceptionType() const
// ---------------------------------------------------------
PropertyError::PropertyError() = default;
PropertyError::PropertyError(const char* sMessage)
: AttributeError(sMessage)
{}
PropertyError::PropertyError(const std::string& sMessage)
: AttributeError(sMessage)
PropertyError::PropertyError(const std::string& message)
: AttributeError(message)
{}
PyObject* PropertyError::getPyExceptionType() const
@@ -629,14 +445,8 @@ PyObject* PropertyError::getPyExceptionType() const
// ---------------------------------------------------------
RuntimeError::RuntimeError() = default;
RuntimeError::RuntimeError(const char* sMessage)
: Exception(sMessage)
{}
RuntimeError::RuntimeError(const std::string& sMessage)
: Exception(sMessage)
RuntimeError::RuntimeError(const std::string& message)
: Exception(message)
{}
PyObject* RuntimeError::getPyExceptionType() const
@@ -646,16 +456,8 @@ PyObject* RuntimeError::getPyExceptionType() const
// ---------------------------------------------------------
BadGraphError::BadGraphError()
: RuntimeError("The graph must be a DAG.")
{}
BadGraphError::BadGraphError(const char* sMessage)
: RuntimeError(sMessage)
{}
BadGraphError::BadGraphError(const std::string& sMessage)
: RuntimeError(sMessage)
BadGraphError::BadGraphError(const std::string& message)
: RuntimeError(message)
{}
PyObject* BadGraphError::getPyExceptionType() const
@@ -665,14 +467,8 @@ PyObject* BadGraphError::getPyExceptionType() const
// ---------------------------------------------------------
NotImplementedError::NotImplementedError() = default;
NotImplementedError::NotImplementedError(const char* sMessage)
: Exception(sMessage)
{}
NotImplementedError::NotImplementedError(const std::string& sMessage)
: Exception(sMessage)
NotImplementedError::NotImplementedError(const std::string& message)
: Exception(message)
{}
PyObject* NotImplementedError::getPyExceptionType() const
@@ -682,14 +478,8 @@ PyObject* NotImplementedError::getPyExceptionType() const
// ---------------------------------------------------------
ZeroDivisionError::ZeroDivisionError() = default;
ZeroDivisionError::ZeroDivisionError(const char* sMessage)
: Exception(sMessage)
{}
ZeroDivisionError::ZeroDivisionError(const std::string& sMessage)
: Exception(sMessage)
ZeroDivisionError::ZeroDivisionError(const std::string& message)
: Exception(message)
{}
PyObject* ZeroDivisionError::getPyExceptionType() const
@@ -699,14 +489,8 @@ PyObject* ZeroDivisionError::getPyExceptionType() const
// ---------------------------------------------------------
ReferenceError::ReferenceError() = default;
ReferenceError::ReferenceError(const char* sMessage)
: Exception(sMessage)
{}
ReferenceError::ReferenceError(const std::string& sMessage)
: Exception(sMessage)
ReferenceError::ReferenceError(const std::string& message)
: Exception(message)
{}
PyObject* ReferenceError::getPyExceptionType() const
@@ -716,14 +500,8 @@ PyObject* ReferenceError::getPyExceptionType() const
// ---------------------------------------------------------
ExpressionError::ExpressionError() = default;
ExpressionError::ExpressionError(const char* sMessage)
: Exception(sMessage)
{}
ExpressionError::ExpressionError(const std::string& sMessage)
: Exception(sMessage)
ExpressionError::ExpressionError(const std::string& message)
: Exception(message)
{}
PyObject* ExpressionError::getPyExceptionType() const
@@ -733,14 +511,8 @@ PyObject* ExpressionError::getPyExceptionType() const
// ---------------------------------------------------------
ParserError::ParserError() = default;
ParserError::ParserError(const char* sMessage)
: Exception(sMessage)
{}
ParserError::ParserError(const std::string& sMessage)
: Exception(sMessage)
ParserError::ParserError(const std::string& message)
: Exception(message)
{}
PyObject* ParserError::getPyExceptionType() const
@@ -750,14 +522,8 @@ PyObject* ParserError::getPyExceptionType() const
// ---------------------------------------------------------
UnicodeError::UnicodeError() = default;
UnicodeError::UnicodeError(const char* sMessage)
: Exception(sMessage)
{}
UnicodeError::UnicodeError(const std::string& sMessage)
: Exception(sMessage)
UnicodeError::UnicodeError(const std::string& message)
: Exception(message)
{}
PyObject* UnicodeError::getPyExceptionType() const
@@ -767,14 +533,8 @@ PyObject* UnicodeError::getPyExceptionType() const
// ---------------------------------------------------------
OverflowError::OverflowError() = default;
OverflowError::OverflowError(const char* sMessage)
: Exception(sMessage)
{}
OverflowError::OverflowError(const std::string& sMessage)
: Exception(sMessage)
OverflowError::OverflowError(const std::string& message)
: Exception(message)
{}
PyObject* OverflowError::getPyExceptionType() const
@@ -784,14 +544,8 @@ PyObject* OverflowError::getPyExceptionType() const
// ---------------------------------------------------------
UnderflowError::UnderflowError() = default;
UnderflowError::UnderflowError(const char* sMessage)
: Exception(sMessage)
{}
UnderflowError::UnderflowError(const std::string& sMessage)
: Exception(sMessage)
UnderflowError::UnderflowError(const std::string& message)
: Exception(message)
{}
PyObject* UnderflowError::getPyExceptionType() const
@@ -801,14 +555,8 @@ PyObject* UnderflowError::getPyExceptionType() const
// ---------------------------------------------------------
UnitsMismatchError::UnitsMismatchError() = default;
UnitsMismatchError::UnitsMismatchError(const char* sMessage)
: Exception(sMessage)
{}
UnitsMismatchError::UnitsMismatchError(const std::string& sMessage)
: Exception(sMessage)
UnitsMismatchError::UnitsMismatchError(const std::string& message)
: Exception(message)
{}
PyObject* UnitsMismatchError::getPyExceptionType() const
@@ -818,14 +566,8 @@ PyObject* UnitsMismatchError::getPyExceptionType() const
// ---------------------------------------------------------
CADKernelError::CADKernelError() = default;
CADKernelError::CADKernelError(const char* sMessage)
: Exception(sMessage)
{}
CADKernelError::CADKernelError(const std::string& sMessage)
: Exception(sMessage)
CADKernelError::CADKernelError(const std::string& message)
: Exception(message)
{}
PyObject* CADKernelError::getPyExceptionType() const
@@ -835,14 +577,8 @@ PyObject* CADKernelError::getPyExceptionType() const
// ---------------------------------------------------------
RestoreError::RestoreError() = default;
RestoreError::RestoreError(const char* sMessage)
: Exception(sMessage)
{}
RestoreError::RestoreError(const std::string& sMessage)
: Exception(sMessage)
RestoreError::RestoreError(const std::string& message)
: Exception(message)
{}
PyObject* RestoreError::getPyExceptionType() const
@@ -855,6 +591,7 @@ PyObject* RestoreError::getPyExceptionType() const
#if defined(__GNUC__) && defined(FC_OS_LINUX)
#include <stdexcept>
#include <iostream>
#include <csignal>
SignalException::SignalException()
{
@@ -876,7 +613,7 @@ SignalException::~SignalException()
#endif
}
void SignalException::throw_signal(int signum)
void SignalException::throw_signal(const int signum)
{
std::cerr << "SIGSEGV signal raised: " << signum << std::endl;
throw std::runtime_error("throw_signal");
+200 -671
View File
File diff suppressed because it is too large Load Diff
+22 -22
View File
@@ -45,7 +45,7 @@ using namespace Base;
PyException::PyException(const Py::Object& obj)
{
_sErrMsg = obj.as_string();
setMessage(obj.as_string());
// WARNING: we are assuming that python type object will never be
// destroyed, so we don't keep reference here to save book-keeping in
// our copy constructor and destructor
@@ -64,7 +64,7 @@ PyException::PyException()
std::string prefix = PP_last_error_type; /* exception name text */
std::string error = PP_last_error_info; /* exception data text */
_sErrMsg = error;
setMessage(error);
_errorType = prefix;
// NOLINTNEXTLINE
@@ -89,10 +89,10 @@ PyException::PyException()
PyException::~PyException() noexcept = default;
void PyException::ThrowException()
void PyException::throwException()
{
PyException myexcp;
myexcp.ReportException();
myexcp.reportException();
myexcp.raiseException();
}
@@ -106,35 +106,35 @@ void PyException::raiseException()
std::string exceptionname;
if (_exceptionType == Base::PyExc_FC_FreeCADAbort) {
edict.setItem("sclassname", Py::String(typeid(Base::AbortException).name()));
edict.setItem("sclassname", Py::String(typeid(AbortException).name()));
}
if (_isReported) {
if (getReported()) {
edict.setItem("breported", Py::True());
}
Base::ExceptionFactory::Instance().raiseException(edict.ptr());
}
if (_exceptionType == Base::PyExc_FC_FreeCADAbort) {
Base::AbortException exc(_sErrMsg.c_str());
exc.setReported(_isReported);
if (_exceptionType == PyExc_FC_FreeCADAbort) {
AbortException exc(getMessage());
exc.setReported(getReported());
throw exc;
}
throw *this;
}
void PyException::ReportException() const
void PyException::reportException() const
{
if (!_isReported) {
_isReported = true;
if (!getReported()) {
setReported(true);
// set sys.last_vars to make post-mortem debugging work
PyGILStateLocker locker;
PySys_SetObject("last_traceback", PP_last_traceback);
Base::Console().DeveloperError("pyException",
"%s%s: %s\n",
_stackTrace.c_str(),
_errorType.c_str(),
what());
Console().DeveloperError("pyException",
"%s%s: %s\n",
_stackTrace.c_str(),
_errorType.c_str(),
what());
}
}
@@ -187,7 +187,7 @@ SystemExitException::SystemExitException()
}
}
_sErrMsg = errMsg;
setMessage(errMsg);
_exitCode = errCode;
}
@@ -252,7 +252,7 @@ std::string InterpreterSingleton::runString(const char* sCmd)
throw SystemExitException();
}
PyException::ThrowException();
PyException::throwException();
return {}; // just to quieten code analyzers
}
@@ -296,7 +296,7 @@ std::string InterpreterSingleton::runStringWithKey(const char* psCmd,
throw SystemExitException();
}
PyException::ThrowException();
PyException::throwException();
return {}; // just to quieten code analyzers
}
Py_DECREF(presult);
@@ -656,8 +656,8 @@ std::string InterpreterSingleton::init(int argc, char* argv[])
}
return getPythonPath();
}
catch (const Base::Exception& e) {
e.ReportException();
catch (const Exception& e) {
e.reportException();
throw;
}
}
+2 -2
View File
@@ -104,7 +104,7 @@ public:
/// this method determines if the original exception
/// can be reconstructed or not, if yes throws the reconstructed version
/// if not, throws a generic PyException.
static void ThrowException();
static void throwException();
/// this function returns the stack trace
const std::string& getStackTrace() const
@@ -119,7 +119,7 @@ public:
{
return _exceptionType;
}
void ReportException() const override;
void reportException() const override;
/// Sets the Python error indicator and an error message
void setPyException() const override;
+2 -2
View File
@@ -82,7 +82,7 @@ public:
}
catch (Py::Exception&) {
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
}
bool isEqual(const Py::Object& obj) const
@@ -777,7 +777,7 @@ void ParameterGrpPy::tryCall(ParameterGrpObserver* obs,
}
catch (Py::Exception&) {
Base::PyException e;
e.ReportException();
e.reportException();
}
}
+1 -1
View File
@@ -1143,7 +1143,7 @@ void RecentMacrosAction::activateFile(int id)
// handle SystemExit exceptions
Base::PyGILStateLocker locker;
Base::PyException exc;
exc.ReportException();
exc.reportException();
}
}
}
+7 -7
View File
@@ -681,7 +681,7 @@ void Application::open(const char* FileName, const char* Module)
}
catch (const Base::PyException& e) {
// Usually thrown if the file is invalid somehow
e.ReportException();
e.reportException();
}
}
else {
@@ -780,7 +780,7 @@ void Application::importFrom(const char* FileName, const char* DocName, const ch
}
catch (const Base::PyException& e) {
// Usually thrown if the file is invalid somehow
e.ReportException();
e.reportException();
}
}
else {
@@ -852,7 +852,7 @@ void Application::exportTo(const char* FileName, const char* DocName, const char
}
catch (const Base::PyException& e) {
// Usually thrown if the file is invalid somehow
e.ReportException();
e.reportException();
wc.restoreCursor();
QMessageBox::critical(getMainWindow(),
QObject::tr("Export failed"),
@@ -1007,7 +1007,7 @@ void Application::checkForRecomputes() {
try {
doc->recompute({}, false, &hasError);
} catch (Base::Exception &e) {
e.ReportException();
e.reportException();
hasError = true;
}
}
@@ -1159,11 +1159,11 @@ void Application::onLastWindowClosed(Gui::Document* pcDoc)
}
}
catch (const Base::Exception& e) {
e.ReportException();
e.reportException();
}
catch (const Py::Exception&) {
Base::PyException e;
e.ReportException();
e.reportException();
}
catch (const std::exception& e) {
Base::Console().Error(
@@ -2672,4 +2672,4 @@ void Application::getVerboseDPIStyleInfo(QTextStream& str) {
<< "/"
<< QApplication::primaryScreen()->devicePixelRatio()
<< "\n";
}
}
+4 -4
View File
@@ -473,17 +473,17 @@ void Command::_invoke(int id, bool disablelog)
throw;
}
catch (Base::PyException &e) {
e.ReportException();
e.reportException();
}
catch (Py::Exception&) {
Base::PyGILStateLocker lock;
Base::PyException e;
e.ReportException();
e.reportException();
}
catch (Base::AbortException&) {
}
catch (Base::Exception &e) {
e.ReportException();
e.reportException();
// Pop-up a dialog for FreeCAD-specific exceptions
QMessageBox::critical(Gui::getMainWindow(), QObject::tr("Exception"), QLatin1String(e.what()));
}
@@ -721,7 +721,7 @@ void Command::_runCommand(const char *file, int line, DoCmd_Type eType, const ch
Base::Interpreter().runString(sCmd);
}
catch(Py::Exception &) {
Base::PyException::ThrowException();
Base::PyException::throwException();
}
}
+2 -2
View File
@@ -1443,7 +1443,7 @@ void StdCmdDelete::activated(int iMsg)
} catch (const Base::Exception& e) {
QMessageBox::critical(getMainWindow(), QObject::tr("Delete failed"),
QString::fromLatin1(e.what()));
e.ReportException();
e.reportException();
} catch (...) {
QMessageBox::critical(getMainWindow(), QObject::tr("Delete failed"),
QStringLiteral("Unknown error"));
@@ -1954,7 +1954,7 @@ protected:
abortCommand();
QMessageBox::critical(getMainWindow(), QObject::tr("Failed to paste expressions"),
QString::fromLatin1(e.what()));
e.ReportException();
e.reportException();
}
}
+1 -1
View File
@@ -293,7 +293,7 @@ void StdCmdSendToPythonConsole::activated(int iMsg)
}
}
catch (const Base::Exception& e) {
e.ReportException();
e.reportException();
}
}
+6 -6
View File
@@ -195,7 +195,7 @@ void StdCmdLinkMakeGroup::activated(int option) {
QMessageBox::critical(getMainWindow(), QObject::tr("Create link group failed"),
QString::fromLatin1(e.what()));
Command::abortCommand();
e.ReportException();
e.reportException();
}
}
@@ -260,7 +260,7 @@ void StdCmdLinkMake::activated(int) {
Command::abortCommand();
QMessageBox::critical(getMainWindow(), QObject::tr("Create link failed"),
QString::fromLatin1(e.what()));
e.ReportException();
e.reportException();
}
}
@@ -335,7 +335,7 @@ void StdCmdLinkMakeRelative::activated(int) {
Command::abortCommand();
QMessageBox::critical(getMainWindow(), QObject::tr("Failed to create relative link"),
QString::fromLatin1(e.what()));
e.ReportException();
e.reportException();
}
return;
}
@@ -463,7 +463,7 @@ static void linkConvert(bool unlink) {
Command::abortCommand();
auto title = unlink?QObject::tr("Unlink failed"):QObject::tr("Replace link failed");
QMessageBox::critical(getMainWindow(), title, QString::fromLatin1(e.what()));
e.ReportException();
e.reportException();
return;
}
}
@@ -593,7 +593,7 @@ void StdCmdLinkImport::activated(int) {
Command::abortCommand();
QMessageBox::critical(getMainWindow(), QObject::tr("Failed to import links"),
QString::fromLatin1(e.what()));
e.ReportException();
e.reportException();
}
}
@@ -633,7 +633,7 @@ void StdCmdLinkImportAll::activated(int) {
QMessageBox::critical(getMainWindow(), QObject::tr("Failed to import all links"),
QString::fromLatin1(e.what()));
Command::abortCommand();
e.ReportException();
e.reportException();
}
}
+2 -2
View File
@@ -138,12 +138,12 @@ void DlgAddProperty::accept()
(*it)->addDynamicProperty(type.c_str(),name.c_str(),
group.c_str(),ui->edtDoc->toPlainText().toUtf8().constData());
} catch(Base::Exception &e) {
e.ReportException();
e.reportException();
for(auto it2=containers.begin();it2!=it;++it2) {
try {
(*it2)->removeDynamicProperty(name.c_str());
} catch(Base::Exception &e) {
e.ReportException();
e.reportException();
}
}
QMessageBox::critical(getMainWindow(),
+1 -1
View File
@@ -460,7 +460,7 @@ bool DlgAddPropertyVarSet::createProperty()
group.c_str(), doc.c_str());
}
catch (Base::Exception& e) {
e.ReportException();
e.reportException();
critical(QObject::tr("Add property"),
QObject::tr("Failed to add property to '%1': %2").arg(
QString::fromLatin1(varSet->getFullName().c_str()),
+1 -1
View File
@@ -396,7 +396,7 @@ void DlgMacroExecuteImp::accept()
// handle SystemExit exceptions
Base::PyGILStateLocker locker;
Base::PyException e;
e.ReportException();
e.reportException();
getMainWindow()->unsetCursor();
}
}
+1 -1
View File
@@ -345,7 +345,7 @@ void DlgPreferencesImp::createPageInGroup(PreferencesPageItem *groupItem, const
}
catch (const Base::Exception& e) {
Base::Console().Error("Base exception thrown for '%s'\n", pageName.c_str());
e.ReportException();
e.reportException();
}
catch (const std::exception& e) {
Base::Console().Error("C++ exception thrown for '%s' (%s)\n", pageName.c_str(), e.what());
+6 -6
View File
@@ -946,7 +946,7 @@ void Document::slotNewObject(const App::DocumentObject& Obj)
FC_ERR("Memory exception in " << Obj.getFullName() << " thrown: " << e.what());
}
catch(Base::Exception &e){
e.ReportException();
e.reportException();
}
#ifndef FC_DEBUG
catch(...){
@@ -957,7 +957,7 @@ void Document::slotNewObject(const App::DocumentObject& Obj)
try {
pcProvider->reattach(const_cast<App::DocumentObject*>(&Obj));
} catch(Base::Exception &e){
e.ReportException();
e.reportException();
}
}
@@ -1062,7 +1062,7 @@ void Document::slotChangedObject(const App::DocumentObject& Obj, const App::Prop
FC_ERR("Memory exception in " << Obj.getFullName() << " thrown: " << e.what());
}
catch(Base::Exception& e){
e.ReportException();
e.reportException();
}
catch(const std::exception& e){
FC_ERR("C++ exception in " << Obj.getFullName() << " thrown " << e.what());
@@ -1441,7 +1441,7 @@ bool Document::save()
}
}
catch (const Base::FileException& e) {
e.ReportException();
e.reportException();
return askIfSavingFailed(QString::fromUtf8(e.what()));
}
catch (const Base::Exception& e) {
@@ -1489,7 +1489,7 @@ bool Document::saveAs()
getMainWindow()->appendRecentFile(fi.filePath());
}
catch (const Base::FileException& e) {
e.ReportException();
e.reportException();
return askIfSavingFailed(QString::fromUtf8(e.what()));
}
catch (const Base::Exception& e) {
@@ -1511,7 +1511,7 @@ void Document::saveAll()
docs = App::Document::getDependentDocuments(App::GetApplication().getDocuments(),true);
}
catch(Base::Exception &e) {
e.ReportException();
e.reportException();
int ret = QMessageBox::critical(getMainWindow(), QObject::tr("Failed to save document"),
QObject::tr("Documents contains cyclic dependencies. Do you still want to save them?"),
QMessageBox::Yes,QMessageBox::No);
+11 -11
View File
@@ -101,7 +101,7 @@ void DocumentObserverPython::slotCreatedDocument(const Gui::Document& Doc)
}
catch (Py::Exception&) {
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
}
@@ -115,7 +115,7 @@ void DocumentObserverPython::slotDeletedDocument(const Gui::Document& Doc)
}
catch (Py::Exception&) {
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
}
@@ -129,7 +129,7 @@ void DocumentObserverPython::slotRelabelDocument(const Gui::Document& Doc)
}
catch (Py::Exception&) {
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
}
@@ -143,7 +143,7 @@ void DocumentObserverPython::slotRenameDocument(const Gui::Document& Doc)
}
catch (Py::Exception&) {
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
}
@@ -157,7 +157,7 @@ void DocumentObserverPython::slotActivateDocument(const Gui::Document& Doc)
}
catch (Py::Exception&) {
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
}
@@ -171,7 +171,7 @@ void DocumentObserverPython::slotCreatedObject(const Gui::ViewProvider& Obj)
}
catch (Py::Exception&) {
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
}
@@ -185,7 +185,7 @@ void DocumentObserverPython::slotDeletedObject(const Gui::ViewProvider& Obj)
}
catch (Py::Exception&) {
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
}
@@ -206,7 +206,7 @@ void DocumentObserverPython::slotBeforeChangeObject(const Gui::ViewProvider& Obj
}
catch (Py::Exception&) {
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
}
@@ -227,7 +227,7 @@ void DocumentObserverPython::slotChangedObject(const Gui::ViewProvider& Obj,
}
catch (Py::Exception&) {
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
}
@@ -241,7 +241,7 @@ void DocumentObserverPython::slotInEdit(const Gui::ViewProviderDocumentObject& O
}
catch (Py::Exception&) {
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
}
@@ -255,6 +255,6 @@ void DocumentObserverPython::slotResetEdit(const Gui::ViewProviderDocumentObject
}
catch (Py::Exception&) {
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
}
+1 -1
View File
@@ -718,7 +718,7 @@ void PythonEditorView::executeScript()
// handle SystemExit exceptions
Base::PyGILStateLocker locker;
Base::PyException e;
e.ReportException();
e.reportException();
getMainWindow()->unsetCursor();
}
}
+10 -10
View File
@@ -182,7 +182,7 @@ MDIViewPyWrap::MDIViewPyWrap(const Py::Object& py, Gui::Document* pcDocument,QWi
catch (Py::Exception&) {
Base::PyGILStateLocker lock;
Base::PyException exc;
exc.ReportException();
exc.reportException();
}
}
@@ -210,7 +210,7 @@ bool MDIViewPyWrap::onMsg(const char* pMsg,const char** ppReturn)
catch (Py::Exception&) {
Base::PyGILStateLocker lock;
Base::PyException exc;
exc.ReportException();
exc.reportException();
return false;
}
}
@@ -229,7 +229,7 @@ bool MDIViewPyWrap::onHasMsg(const char* pMsg) const
catch (Py::Exception&) {
Base::PyGILStateLocker lock;
Base::PyException exc;
exc.ReportException();
exc.reportException();
return false;
}
}
@@ -245,7 +245,7 @@ bool MDIViewPyWrap::canClose()
catch (Py::Exception&) {
Base::PyGILStateLocker lock;
Base::PyException exc;
exc.ReportException();
exc.reportException();
return false;
}
}
@@ -261,7 +261,7 @@ void MDIViewPyWrap::print(QPrinter* printer)
catch (Py::Exception&) {
Base::PyGILStateLocker lock;
Base::PyException exc;
exc.ReportException();
exc.reportException();
}
}
@@ -276,7 +276,7 @@ void MDIViewPyWrap::print()
catch (Py::Exception&) {
Base::PyGILStateLocker lock;
Base::PyException exc;
exc.ReportException();
exc.reportException();
}
}
@@ -291,7 +291,7 @@ void MDIViewPyWrap::printPdf()
catch (Py::Exception&) {
Base::PyGILStateLocker lock;
Base::PyException exc;
exc.ReportException();
exc.reportException();
}
}
@@ -306,7 +306,7 @@ void MDIViewPyWrap::printPreview()
catch (Py::Exception&) {
Base::PyGILStateLocker lock;
Base::PyException exc;
exc.ReportException();
exc.reportException();
}
}
@@ -321,7 +321,7 @@ QStringList MDIViewPyWrap::undoActions() const
catch (Py::Exception&) {
Base::PyGILStateLocker lock;
Base::PyException exc;
exc.ReportException();
exc.reportException();
return MDIView::undoActions();
}
}
@@ -337,7 +337,7 @@ QStringList MDIViewPyWrap::redoActions() const
catch (Py::Exception&) {
Base::PyGILStateLocker lock;
Base::PyException exc;
exc.ReportException();
exc.reportException();
return MDIView::redoActions();
}
}
+1 -1
View File
@@ -389,7 +389,7 @@ void MacroManager::run(MacroType eType, const char *sName)
throw;
}
catch (const Base::PyException& e) {
e.ReportException();
e.reportException();
}
catch (const Base::Exception& e) {
qWarning("%s",e.what());
+3 -3
View File
@@ -851,7 +851,7 @@ bool MainWindow::closeAllDocuments (bool close)
docs = App::Document::getDependentDocuments(docs, true);
}
catch(Base::Exception &e) {
e.ReportException();
e.reportException();
}
bool checkModify = true;
@@ -958,7 +958,7 @@ void MainWindow::showDocumentation(const QString& help)
}
}
catch (const Base::Exception& e) {
e.ReportException();
e.reportException();
}
}
@@ -1536,7 +1536,7 @@ void MainWindow::delayedStartup()
throw;
}
catch (const Base::Exception& e) {
e.ReportException();
e.reportException();
}
});
return;
@@ -1004,7 +1004,7 @@ void GestureNavigationStyle::onRollGesture(int direction)
try {
Base::Interpreter().runString(code.str().c_str());
} catch (Base::PyException& exc) {
exc.ReportException();
exc.reportException();
} catch (...) {
Base::Console().Error("GestureNavigationStyle::onRollGesture: unknown C++ exception when invoking command %s\n", cmd.c_str());
}
+1 -1
View File
@@ -124,7 +124,7 @@ QByteArray PythonOnlineHelp::invoke(const std::function<std::string(Py::Module&)
catch (const Py::Exception&) {
// load the error page
Base::PyException e;
e.ReportException();
e.reportException();
return loadFailed(QString::fromUtf8(e.what()));
}
}
+1 -1
View File
@@ -601,7 +601,7 @@ qsizetype PythonWrapper::toEnum(PyObject* pyPtr)
}
catch (Py::Exception&) {
Base::PyException e;
e.ReportException();
e.reportException();
return 0;
}
}
+1 -1
View File
@@ -154,7 +154,7 @@ void SelectionObserver::_onSelectionChanged(const SelectionChanges& msg) {
return;
onSelectionChanged(msg);
} catch (Base::Exception &e) {
e.ReportException();
e.reportException();
FC_ERR("Unhandled Base::Exception caught in selection observer: ");
} catch (std::exception &e) {
FC_ERR("Unhandled std::exception caught in selection observer: " << e.what());
+1 -1
View File
@@ -104,7 +104,7 @@ bool SelectionGatePython::allow(App::Document* doc, App::DocumentObject* obj, co
}
catch (Py::Exception&) {
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
return true;
@@ -92,7 +92,7 @@ void SelectionObserverPythonHandler::pickedListChanged()
}
catch (Py::Exception&) {
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
}
@@ -115,7 +115,7 @@ void SelectionObserverPythonHandler::addSelection(const SelectionChanges& msg)
}
catch (Py::Exception&) {
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
}
@@ -133,7 +133,7 @@ void SelectionObserverPythonHandler::removeSelection(const SelectionChanges& msg
}
catch (Py::Exception&) {
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
}
@@ -149,7 +149,7 @@ void SelectionObserverPythonHandler::setSelection(const SelectionChanges& msg)
}
catch (Py::Exception&) {
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
}
@@ -165,7 +165,7 @@ void SelectionObserverPythonHandler::clearSelection(const SelectionChanges& msg)
}
catch (Py::Exception&) {
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
}
@@ -183,7 +183,7 @@ void SelectionObserverPythonHandler::setPreselection(const SelectionChanges& msg
}
catch (Py::Exception&) {
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
}
@@ -201,7 +201,7 @@ void SelectionObserverPythonHandler::removePreselection(const SelectionChanges&
}
catch (Py::Exception&) {
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
}
+9 -9
View File
@@ -343,7 +343,7 @@ void SelectionView::select(QListWidgetItem* item)
Gui::Command::runCommand(Gui::Command::Gui, cmd.toLatin1());
}
catch (Base::Exception& e) {
e.ReportException();
e.reportException();
}
}
@@ -366,7 +366,7 @@ void SelectionView::deselect()
Gui::Command::runCommand(Gui::Command::Gui, cmd.toLatin1());
}
catch (Base::Exception& e) {
e.ReportException();
e.reportException();
}
}
@@ -418,7 +418,7 @@ void SelectionView::toggleSelect(QListWidgetItem* item)
Gui::Command::runCommand(Gui::Command::Gui, cmd.toLatin1());
}
catch (Base::Exception& e) {
e.ReportException();
e.reportException();
}
}
@@ -457,7 +457,7 @@ void SelectionView::preselect(QListWidgetItem* item)
Gui::Command::runCommand(Gui::Command::Gui, cmd.toLatin1());
}
catch (Base::Exception& e) {
e.ReportException();
e.reportException();
}
}
@@ -468,7 +468,7 @@ void SelectionView::zoom()
Gui::Command::runCommand(Gui::Command::Gui, "Gui.SendMsgToActiveView(\"ViewSelection\")");
}
catch (Base::Exception& e) {
e.ReportException();
e.reportException();
}
}
@@ -479,7 +479,7 @@ void SelectionView::treeSelect()
Gui::Command::runCommand(Gui::Command::Gui, "Gui.runCommand(\"Std_TreeSelection\")");
}
catch (Base::Exception& e) {
e.ReportException();
e.reportException();
}
}
@@ -499,7 +499,7 @@ void SelectionView::touch()
Gui::Command::runCommand(Gui::Command::Doc, cmd.toLatin1());
}
catch (Base::Exception& e) {
e.ReportException();
e.reportException();
}
}
@@ -535,7 +535,7 @@ void SelectionView::toPython()
}
}
catch (const Base::Exception& e) {
e.ReportException();
e.reportException();
}
}
@@ -560,7 +560,7 @@ void SelectionView::showPart()
Gui::Command::runCommand(Gui::Command::Gui, cmd.toLatin1());
}
catch (const Base::Exception& e) {
e.ReportException();
e.reportException();
}
}
}
+1 -1
View File
@@ -287,7 +287,7 @@ void SoFCColorBar::customize(SoFCColorBarBase* child)
return child->customize(this);
}
catch (const Base::ValueError& e) {
e.ReportException();
e.reportException();
}
}
+1 -1
View File
@@ -440,7 +440,7 @@ void SoFCColorGradient::customize(SoFCColorBarBase* parentNode)
applyProfile(dlg.getProfile(), dlg.numberOfDecimals());
}
catch (const Base::Exception& e) {
e.ReportException();
e.reportException();
}
});
+1 -1
View File
@@ -108,7 +108,7 @@ public:
vpParent->OnTopWhenSelected.setValue(onTopMode);
}
catch (const Base::Exception& e) {
e.ReportException();
e.reportException();
}
}
+15 -15
View File
@@ -303,7 +303,7 @@ bool TaskWatcherPython::shouldShow()
}
catch (Py::Exception&) {
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
if (!this->Filter.empty())
@@ -660,7 +660,7 @@ void TaskDialogPython::open()
}
catch (Py::Exception&) {
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
}
@@ -678,7 +678,7 @@ void TaskDialogPython::clicked(int i)
}
catch (Py::Exception&) {
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
}
@@ -695,7 +695,7 @@ bool TaskDialogPython::accept()
}
catch (Py::Exception&) {
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
return TaskDialog::accept();
@@ -714,7 +714,7 @@ bool TaskDialogPython::reject()
}
catch (Py::Exception&) {
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
return TaskDialog::reject();
@@ -732,7 +732,7 @@ void TaskDialogPython::helpRequested()
}
catch (Py::Exception&) {
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
}
@@ -750,7 +750,7 @@ bool TaskDialogPython::eventFilter(QObject *watched, QEvent *event)
}
catch (Py::Exception&) {
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
}
@@ -772,7 +772,7 @@ QDialogButtonBox::StandardButtons TaskDialogPython::getStandardButtons() const
}
catch (Py::Exception&) {
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
return TaskDialog::getStandardButtons();
@@ -794,7 +794,7 @@ void TaskDialogPython::modifyStandardButtons(QDialogButtonBox *buttonBox)
}
catch (Py::Exception&) {
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
}
@@ -811,7 +811,7 @@ bool TaskDialogPython::isAllowedAlterDocument() const
}
catch (Py::Exception&) {
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
return TaskDialog::isAllowedAlterDocument();
@@ -830,7 +830,7 @@ bool TaskDialogPython::isAllowedAlterView() const
}
catch (Py::Exception&) {
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
return TaskDialog::isAllowedAlterView();
@@ -849,7 +849,7 @@ bool TaskDialogPython::isAllowedAlterSelection() const
}
catch (Py::Exception&) {
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
return TaskDialog::isAllowedAlterSelection();
@@ -868,7 +868,7 @@ bool TaskDialogPython::needsFullSpace() const
}
catch (Py::Exception&) {
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
return TaskDialog::needsFullSpace();
@@ -886,7 +886,7 @@ void TaskDialogPython::autoClosedOnTransactionChange()
}
catch (Py::Exception&) {
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
}
@@ -902,6 +902,6 @@ void TaskDialogPython::autoClosedOnDeletedDocument()
}
catch (Py::Exception&) {
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
}
+6 -6
View File
@@ -1182,7 +1182,7 @@ void TreeWidget::contextMenuEvent(QContextMenuEvent* e)
contextMenu.exec(QCursor::pos());
}
catch (Base::Exception& e) {
e.ReportException();
e.reportException();
}
catch (std::exception& e) {
FC_ERR("C++ exception: " << e.what());
@@ -1808,7 +1808,7 @@ void TreeWidget::mouseDoubleClickEvent(QMouseEvent* event)
}
}
catch (Base::Exception& e) {
e.ReportException();
e.reportException();
}
catch (std::exception& e) {
FC_ERR("C++ exception: " << e.what());
@@ -2071,7 +2071,7 @@ void TreeWidget::dragMoveEvent(QDragMoveEvent* event)
}
}
catch (Base::Exception& e) {
e.ReportException();
e.reportException();
event->ignore();
}
catch (std::exception& e) {
@@ -2320,7 +2320,7 @@ bool TreeWidget::dropInDocument(QDropEvent* event, TargetItemInfo& targetInfo,
}
}
catch (const Base::Exception& e) {
e.ReportException();
e.reportException();
errMsg = e.what();
}
catch (std::exception& e) {
@@ -2682,7 +2682,7 @@ bool TreeWidget::dropInObject(QDropEvent* event, TargetItemInfo& targetInfo,
}
}
catch (const Base::Exception& e) {
e.ReportException();
e.reportException();
errMsg = e.what();
}
catch (std::exception& e) {
@@ -2874,7 +2874,7 @@ void TreeWidget::onCloseDoc()
Command::doCommand(Command::Doc, "App.closeDocument(\"%s\")", doc->getName());
}
catch (const Base::Exception& e) {
e.ReportException();
e.reportException();
}
catch (std::exception& e) {
FC_ERR("C++ exception: " << e.what());
+43 -43
View File
@@ -151,7 +151,7 @@ QIcon ViewProviderFeaturePythonImp::getIcon() const
PyErr_Clear();
else {
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
}
@@ -179,7 +179,7 @@ bool ViewProviderFeaturePythonImp::claimChildren(std::vector<App::DocumentObject
return false;
}
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
return true;
@@ -202,7 +202,7 @@ ViewProviderFeaturePythonImp::useNewSelectionModel() const
return NotImplemented;
}
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
return Accepted;
@@ -231,7 +231,7 @@ bool ViewProviderFeaturePythonImp::getElement(const SoDetail *det, std::string &
return true;
}
catch (const Base::Exception& e) {
e.ReportException();
e.reportException();
}
catch (Py::Exception&) {
if (PyErr_ExceptionMatches(PyExc_NotImplementedError)) {
@@ -239,7 +239,7 @@ bool ViewProviderFeaturePythonImp::getElement(const SoDetail *det, std::string &
return false;
}
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
return true;
@@ -263,7 +263,7 @@ ViewProviderFeaturePythonImp::getElementPicked(const SoPickedPoint *pp, std::str
return Accepted;
}
catch (const Base::Exception& e) {
e.ReportException();
e.reportException();
}
catch (Py::Exception&) {
if (PyErr_ExceptionMatches(PyExc_NotImplementedError)) {
@@ -271,7 +271,7 @@ ViewProviderFeaturePythonImp::getElementPicked(const SoPickedPoint *pp, std::str
return NotImplemented;
}
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
return Rejected;
@@ -294,7 +294,7 @@ bool ViewProviderFeaturePythonImp::getDetail(const char* name, SoDetail *&det) c
return true;
}
catch (const Base::Exception& e) {
e.ReportException();
e.reportException();
}
catch (Py::Exception&) {
if (PyErr_ExceptionMatches(PyExc_NotImplementedError)) {
@@ -302,7 +302,7 @@ bool ViewProviderFeaturePythonImp::getDetail(const char* name, SoDetail *&det) c
return false;
}
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
return true;
@@ -337,7 +337,7 @@ ViewProviderFeaturePythonImp::ValueT ViewProviderFeaturePythonImp::getDetailPath
delete det;
}
catch (const Base::Exception& e) {
e.ReportException();
e.reportException();
}
catch (Py::Exception&) {
if (PyErr_ExceptionMatches(PyExc_NotImplementedError)) {
@@ -345,7 +345,7 @@ ViewProviderFeaturePythonImp::ValueT ViewProviderFeaturePythonImp::getDetailPath
return NotImplemented;
}
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
path->truncate(length);
return Rejected;
@@ -392,7 +392,7 @@ ViewProviderFeaturePythonImp::setEdit(int ModNum)
return NotImplemented;
}
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
return Rejected;
@@ -433,7 +433,7 @@ ViewProviderFeaturePythonImp::unsetEdit(int ModNum)
return NotImplemented;
}
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
return Rejected;
@@ -459,7 +459,7 @@ ViewProviderFeaturePythonImp::setEditViewer(View3DInventorViewer *viewer, int Mo
return NotImplemented;
}
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
return Rejected;
}
@@ -484,7 +484,7 @@ ViewProviderFeaturePythonImp::unsetEditViewer(View3DInventorViewer *viewer)
return NotImplemented;
}
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
return Rejected;
}
@@ -516,7 +516,7 @@ ViewProviderFeaturePythonImp::doubleClicked()
return NotImplemented;
}
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
return Rejected;
@@ -553,7 +553,7 @@ bool ViewProviderFeaturePythonImp::setupContextMenu(QMenu* menu)
return false;
}
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
return true;
}
@@ -580,7 +580,7 @@ void ViewProviderFeaturePythonImp::attach(App::DocumentObject *pcObject)
}
catch (Py::Exception&) {
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
}
@@ -612,7 +612,7 @@ void ViewProviderFeaturePythonImp::updateData(const App::Property* prop)
}
catch (Py::Exception&) {
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
}
@@ -644,7 +644,7 @@ void ViewProviderFeaturePythonImp::onChanged(const App::Property* prop)
}
catch (Py::Exception&) {
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
}
@@ -676,7 +676,7 @@ void ViewProviderFeaturePythonImp::onBeforeChange(const App::Property* prop)
}
catch (Py::Exception&) {
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
}
@@ -698,7 +698,7 @@ void ViewProviderFeaturePythonImp::finishRestoring()
}
}catch (Py::Exception&) {
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
}
@@ -735,7 +735,7 @@ ViewProviderFeaturePythonImp::onDelete(const std::vector<std::string> & sub)
return NotImplemented;
}
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
return Rejected;
}
}
@@ -757,7 +757,7 @@ ViewProviderFeaturePythonImp::canDelete(App::DocumentObject *obj) const
return NotImplemented;
}
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
return Rejected;
}
}
@@ -777,7 +777,7 @@ ViewProviderFeaturePythonImp::canAddToSceneGraph() const
return NotImplemented;
}
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
return Accepted;
}
@@ -799,7 +799,7 @@ bool ViewProviderFeaturePythonImp::getDefaultDisplayMode(std::string &mode) cons
return false;
}
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
return true;
@@ -835,7 +835,7 @@ std::vector<std::string> ViewProviderFeaturePythonImp::getDisplayModes() const
PyErr_Clear();
else {
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
}
@@ -856,7 +856,7 @@ std::string ViewProviderFeaturePythonImp::setDisplayMode(const char* ModeName)
}
catch (Py::Exception&) {
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
return ModeName;
@@ -878,7 +878,7 @@ ViewProviderFeaturePythonImp::canDragObjects() const
return NotImplemented;
}
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
return Rejected;
@@ -902,7 +902,7 @@ ViewProviderFeaturePythonImp::canDragObject(App::DocumentObject* obj) const
return NotImplemented;
}
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
return Rejected;
@@ -936,7 +936,7 @@ ViewProviderFeaturePythonImp::dragObject(App::DocumentObject* obj)
return NotImplemented;
}
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
return Rejected;
@@ -958,7 +958,7 @@ ViewProviderFeaturePythonImp::canDropObjects() const
return NotImplemented;
}
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
return Rejected;
@@ -982,7 +982,7 @@ ViewProviderFeaturePythonImp::canDropObject(App::DocumentObject* obj) const
return NotImplemented;
}
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
return Rejected;
@@ -1014,7 +1014,7 @@ ViewProviderFeaturePythonImp::dropObject(App::DocumentObject* obj)
PyErr_Clear();
return NotImplemented;
}
Base::PyException::ThrowException();
Base::PyException::throwException();
}
return Rejected;
@@ -1037,7 +1037,7 @@ ViewProviderFeaturePythonImp::canDragAndDropObject(App::DocumentObject *obj) con
return NotImplemented;
}
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
return Rejected;
@@ -1069,7 +1069,7 @@ ViewProviderFeaturePythonImp::canDropObjectEx(App::DocumentObject* obj,
return NotImplemented;
}
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
return Rejected;
@@ -1102,7 +1102,7 @@ bool ViewProviderFeaturePythonImp::dropObjectEx(App::DocumentObject* obj, App::D
PyErr_Clear();
return false;
}
Base::PyException::ThrowException();
Base::PyException::throwException();
}
return true;
}
@@ -1123,7 +1123,7 @@ ViewProviderFeaturePythonImp::isShow() const
return NotImplemented;
}
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
return Rejected;
@@ -1146,7 +1146,7 @@ ViewProviderFeaturePythonImp::canRemoveChildrenFromRoot() const {
return NotImplemented;
}
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
return Rejected;
}
@@ -1169,7 +1169,7 @@ bool ViewProviderFeaturePythonImp::getDropPrefix(std::string &prefix) const {
return false;
}
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
return true;
}
@@ -1197,7 +1197,7 @@ ViewProviderFeaturePythonImp::replaceObject(
return NotImplemented;
}
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
return Rejected;
}
@@ -1239,7 +1239,7 @@ bool ViewProviderFeaturePythonImp::getLinkedViewProvider(
return false;
}
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
return true;
}
@@ -1261,7 +1261,7 @@ bool ViewProviderFeaturePythonImp::editProperty(const char *name)
}
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
return false;
}
+10 -10
View File
@@ -2521,7 +2521,7 @@ void ViewProviderLink::setupContextMenu(QMenu* menu, QObject* receiver, const ch
}
Command::updateActive();
} catch (Base::Exception &e) {
e.ReportException();
e.reportException();
}
});
}
@@ -2539,7 +2539,7 @@ void ViewProviderLink::setupContextMenu(QMenu* menu, QObject* receiver, const ch
ext->getLinkCopyOnChangeProperty()->setValue(1);
Command::updateActive();
} catch (Base::Exception &e) {
e.ReportException();
e.reportException();
}
});
act = submenu->addAction(QObject::tr("Tracking"));
@@ -2553,7 +2553,7 @@ void ViewProviderLink::setupContextMenu(QMenu* menu, QObject* receiver, const ch
ext->getLinkCopyOnChangeProperty()->setValue(3);
Command::updateActive();
} catch (Base::Exception &e) {
e.ReportException();
e.reportException();
}
});
}
@@ -2571,7 +2571,7 @@ void ViewProviderLink::setupContextMenu(QMenu* menu, QObject* receiver, const ch
ext->getLinkCopyOnChangeProperty()->setValue((long)0);
Command::updateActive();
} catch (Base::Exception &e) {
e.ReportException();
e.reportException();
}
});
}
@@ -2590,7 +2590,7 @@ void ViewProviderLink::setupContextMenu(QMenu* menu, QObject* receiver, const ch
ext->syncCopyOnChange();
Command::updateActive();
} catch (Base::Exception &e) {
e.ReportException();
e.reportException();
}
});
}
@@ -2616,7 +2616,7 @@ void ViewProviderLink::_setupContextMenu(
ext->getShowElementProperty()->setValue(!ext->getShowElementValue());
Command::updateActive();
} catch (Base::Exception &e) {
e.ReportException();
e.reportException();
}
});
action->setToolTip(QObject::tr(
@@ -2692,7 +2692,7 @@ bool ViewProviderLink::initDraggingPlacement() {
}
} catch (Py::Exception&) {
Base::PyException e;
e.ReportException();
e.reportException();
return false;
}
@@ -2897,7 +2897,7 @@ bool ViewProviderLink::callDraggerProxy(const char* fname) {
}
} catch (Py::Exception&) {
Base::PyException e;
e.ReportException();
e.reportException();
return true;
}
@@ -2936,10 +2936,10 @@ void ViewProviderLink::updateLinks(ViewProvider *vp) {
ext->linkInfo->update();
}
catch (const Base::TypeError &e) {
e.ReportException();
e.reportException();
}
catch (const Base::ValueError &e) {
e.ReportException();
e.reportException();
}
}
+2 -2
View File
@@ -314,7 +314,7 @@ void PreferencePagePython::loadSettings()
}
catch (Py::Exception&) {
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
}
@@ -330,7 +330,7 @@ void PreferencePagePython::saveSettings()
}
catch (Py::Exception&) {
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
}
+4 -4
View File
@@ -89,7 +89,7 @@ void WorkbenchManipulatorPython::modifyMenuBar(MenuItem* menuBar)
}
catch (Py::Exception&) {
Base::PyException exc; // extract the Python error text
exc.ReportException();
exc.reportException();
}
}
@@ -194,7 +194,7 @@ void WorkbenchManipulatorPython::modifyContextMenu(const char* recipient, MenuIt
}
catch (Py::Exception&) {
Base::PyException exc; // extract the Python error text
exc.ReportException();
exc.reportException();
}
}
@@ -232,7 +232,7 @@ void WorkbenchManipulatorPython::modifyToolBars(ToolBarItem* toolBar)
}
catch (Py::Exception&) {
Base::PyException exc; // extract the Python error text
exc.ReportException();
exc.reportException();
}
}
@@ -340,7 +340,7 @@ void WorkbenchManipulatorPython::modifyDockWindows(DockWindowItems* dockWindow)
}
catch (Py::Exception&) {
Base::PyException exc; // extract the Python error text
exc.ReportException();
exc.reportException();
}
}
+2 -2
View File
@@ -377,7 +377,7 @@ void PropertyEditor::recomputeDocument(App::Document* doc)
}
// do not re-throw
catch (const Base::Exception& e) {
e.ReportException();
e.reportException();
}
catch (const std::exception& e) {
Base::Console().Error(
@@ -919,7 +919,7 @@ void PropertyEditor::contextMenuEvent(QContextMenuEvent*)
prop->getContainer()->removeDynamicProperty(prop->getName());
}
catch (Base::Exception& e) {
e.ReportException();
e.reportException();
}
}
break;
+3 -3
View File
@@ -636,11 +636,11 @@ void PropertyItem::setPropertyValue(const std::string& value)
Gui::Command::runCommand(Gui::Command::App, cmd.c_str());
}
catch (Base::PyException& e) {
e.ReportException();
e.reportException();
Base::Console().Error("Stack Trace: %s\n", e.getStackTrace().c_str());
}
catch (Base::Exception& e) {
e.ReportException();
e.reportException();
}
catch (...) {
Base::Console().Error("Unknown C++ exception in PropertyItem::setPropertyValue thrown\n");
@@ -811,7 +811,7 @@ QString PropertyItem::expressionAsString() const
return QString::fromStdString(result->toString());
}
catch (const Base::Exception& e) {
e.ReportException();
e.reportException();
}
}
+1 -1
View File
@@ -137,7 +137,7 @@ int main(int argc, char** argv)
exit(e.getExitCode());
}
catch (const Base::Exception& e) {
e.ReportException();
e.reportException();
exit(1);
}
catch (...) {
+1 -1
View File
@@ -328,7 +328,7 @@ int main(int argc, char** argv)
exit(e.getExitCode());
}
catch (const Base::Exception& e) {
e.ReportException();
e.reportException();
exit(1);
}
catch (const std::exception& e) {
+1 -1
View File
@@ -72,7 +72,7 @@
str += "FreeCAD exception thrown ("; \
str += e.what(); \
str += ")"; \
e.ReportException(); \
e.reportException(); \
PyErr_SetString(Base::PyExc_FC_GeneralError, str.c_str()); \
} \
catch (std::exception & e) \
+1 -1
View File
@@ -131,7 +131,7 @@ private:
str += "FreeCAD exception thrown (";
str += e.what();
str += ")";
e.ReportException();
e.reportException();
throw Py::RuntimeError(str);
}
catch (const std::exception& e) {
+2 -2
View File
@@ -889,7 +889,7 @@ void TaskPostDataAlongLine::point1Changed(double)
getObject<Fem::FemPostDataAlongLineFilter>()->GetAxisData();
}
catch (const Base::Exception& e) {
e.ReportException();
e.reportException();
}
}
@@ -1204,7 +1204,7 @@ void TaskPostDataAtPoint::centerChanged(double)
onFieldActivated(currentField);
}
catch (const Base::Exception& e) {
e.ReportException();
e.reportException();
}
}
@@ -674,7 +674,7 @@ void ViewProviderFemPostObject::setRangeOfColorBar(float min, float max)
m_colorBar->setRange(min, max);
}
catch (const Base::ValueError& e) {
e.ReportException();
e.reportException();
}
}
+1 -1
View File
@@ -101,7 +101,7 @@ void ImportOCAF::tryPlacementFromMatrix(App::GeoFeature* part, const Base::Matri
part->Placement.setValue(pl);
}
catch (const Base::ValueError& e) {
e.ReportException();
e.reportException();
}
}
+1 -1
View File
@@ -2912,7 +2912,7 @@ bool CDxfRead::ReadEntitiesSection()
}
}
catch (const Base::Exception& e) {
e.ReportException();
e.reportException();
}
catch (...) {
ImportError("CDxfRead::ReadEntity raised unknown exception\n");
+1 -1
View File
@@ -124,7 +124,7 @@ private:
str += "FreeCAD exception thrown (";
str += e.what();
str += ")";
e.ReportException();
e.reportException();
throw Py::RuntimeError(str);
}
catch (const std::exception& e) {
+4 -4
View File
@@ -81,7 +81,7 @@ std::vector<App::DocumentObject*> MeasureBase::getSubject() const
}
catch (Py::Exception&) {
Base::PyException e;
e.ReportException();
e.reportException();
return {};
}
@@ -116,7 +116,7 @@ void MeasureBase::parseSelection(const App::MeasureSelection& selection)
}
catch (Py::Exception&) {
Base::PyException e;
e.ReportException();
e.reportException();
}
}
@@ -136,7 +136,7 @@ std::vector<std::string> MeasureBase::getInputProps()
}
catch (Py::Exception&) {
Base::PyException e;
e.ReportException();
e.reportException();
return {};
}
Py::Sequence propsPy(ret);
@@ -168,7 +168,7 @@ QString MeasureBase::getResultString()
}
catch (Py::Exception&) {
Base::PyException e;
e.ReportException();
e.reportException();
return QString();
}
return QString::fromStdString(ret.as_string());
+1 -1
View File
@@ -92,7 +92,7 @@ void QuickMeasure::processSelection()
// sub-element e.g. when selecting a constraint in sketcher
}
catch (const Base::Exception& e) {
e.ReportException();
e.reportException();
}
catch (const Standard_Failure& e) {
FC_ERR(e);
+1 -1
View File
@@ -149,7 +149,7 @@ PyMOD_INIT_FUNC(MeshGui)
Base::Interpreter().runString("import MeshFlatteningCommand");
}
catch (Base::PyException& err) {
err.ReportException();
err.reportException();
}
// register preferences pages
+1 -1
View File
@@ -163,7 +163,7 @@ private:
str += "FreeCAD exception thrown (";
str += e.what();
str += ")";
e.ReportException();
e.reportException();
throw Py::RuntimeError(str);
}
catch (const std::exception &e) {
+2 -2
View File
@@ -666,7 +666,7 @@ private:
str += "FreeCAD exception thrown (";
str += e.what();
str += ")";
e.ReportException();
e.reportException();
throw Py::RuntimeError(str);
}
catch (const std::exception &e) {
@@ -699,7 +699,7 @@ private:
str += "FreeCAD exception thrown (";
str += e.what();
str += ")";
e.ReportException();
e.reportException();
throw Py::RuntimeError(str);
}
catch (const std::exception &e) {
+8 -8
View File
@@ -6338,7 +6338,7 @@ GeomArcOfCircle* createFilletGeometry(const Geometry* geo1, const Geometry* geo2
}
}
catch (Base::CADKernelError& e) {
e.ReportException();
e.reportException();
THROWM(Base::CADKernelError,
"Unable to determine the parameter of the first selected curve at the reference "
"point.")
@@ -6350,7 +6350,7 @@ GeomArcOfCircle* createFilletGeometry(const Geometry* geo1, const Geometry* geo2
}
}
catch (Base::CADKernelError& e) {
e.ReportException();
e.reportException();
THROWM(Base::CADKernelError,
"Unable to determine the parameter of the second selected curve at the "
"reference point.")
@@ -6423,7 +6423,7 @@ GeomArcOfCircle* createFilletGeometry(const Geometry* geo1, const Geometry* geo2
}
}
catch (Base::CADKernelError& e) {
e.ReportException();
e.reportException();
THROWMT(Base::CADKernelError,
QT_TRANSLATE_NOOP("Exceptions",
"Unable to guess intersection of curves. Try adding "
@@ -6449,7 +6449,7 @@ GeomArcOfCircle* createFilletGeometry(const Geometry* geo1, const Geometry* geo2
}
}
catch (Base::CADKernelError& e) {
e.ReportException();
e.reportException();
THROWM(Base::CADKernelError,
"Unable to determine the parameter of the first selected curve at the "
"intersection of the curves.")
@@ -6461,7 +6461,7 @@ GeomArcOfCircle* createFilletGeometry(const Geometry* geo1, const Geometry* geo2
}
}
catch (Base::CADKernelError& e) {
e.ReportException();
e.reportException();
THROWM(Base::CADKernelError,
"Unable to determine the parameter of the second selected curve at the "
"intersection of the curves.")
@@ -6549,7 +6549,7 @@ GeomArcOfCircle* createFilletGeometry(const Geometry* geo1, const Geometry* geo2
}
}
catch (Base::CADKernelError& e) {
e.ReportException();
e.reportException();
THROWM(Base::CADKernelError, "Unable to find intersection between offset curves.")
}
@@ -6568,7 +6568,7 @@ GeomArcOfCircle* createFilletGeometry(const Geometry* geo1, const Geometry* geo2
}
}
catch (Base::CADKernelError& e) {
e.ReportException();
e.reportException();
THROWM(Base::CADKernelError, "Unable to determine the starting point of the arc.")
}
@@ -6578,7 +6578,7 @@ GeomArcOfCircle* createFilletGeometry(const Geometry* geo1, const Geometry* geo2
}
}
catch (Base::CADKernelError& e) {
e.ReportException();
e.reportException();
THROWM(Base::CADKernelError, "Unable to determine the end point of the arc.")
}
+1 -1
View File
@@ -877,7 +877,7 @@ void Feature::setMaterialAppearance(const App::Material& material)
ShapeMaterial.setValue(material);
}
catch (const Base::Exception& e) {
e.ReportException();
e.reportException();
}
}
+1 -1
View File
@@ -236,7 +236,7 @@ PyMOD_INIT_FUNC(PartGui)
Py::Module(partGuiModule).setAttr(std::string("AttachmentEditor"), ae);
}
catch (Base::PyException& err) {
err.ReportException();
err.reportException();
}
// register preferences pages
+1 -1
View File
@@ -196,7 +196,7 @@ void CmdPartPointsFromMesh::activated(int iMsg)
}
catch (Py::Exception&) {
Base::PyException e;
e.ReportException();
e.reportException();
}
commitCommand();
+1 -1
View File
@@ -461,7 +461,7 @@ void DlgBooleanOperation::accept()
activeDoc->recompute();
}
catch (const Base::Exception& e) {
e.ReportException();
e.reportException();
}
}
+2 -2
View File
@@ -227,7 +227,7 @@ void DlgExtrusion::onSelectEdgeClicked()
QByteArray code_2 = code.arg(features_to_hide).toLatin1();
Base::Interpreter().runString(code_2.constData());
} catch (Base::PyException &e){
e.ReportException();
e.reportException();
}
} else {
Gui::Selection().rmvSelectionGate();
@@ -238,7 +238,7 @@ void DlgExtrusion::onSelectEdgeClicked()
try{
Base::Interpreter().runString("del(tv)");
} catch (Base::PyException &e){
e.ReportException();
e.reportException();
}
}
}
+2 -2
View File
@@ -162,13 +162,13 @@ DlgProjectionOnSurface::DlgProjectionOnSurface(QWidget* parent)
m_partDocument = App::GetApplication().getActiveDocument();
if (!m_partDocument) {
throw Base::ValueError(QString(tr("Have no active document!!!")).toUtf8());
throw Base::ValueError(tr("Have no active document!!!").toStdString());
}
this->attachDocument(m_partDocument);
m_partDocument->openTransaction("Project on surface");
m_projectionObject = m_partDocument->addObject<Part::Feature>("Projection Object");
if (!m_projectionObject) {
throw Base::ValueError(QString(tr("Can not create a projection object!!!")).toUtf8());
throw Base::ValueError(tr("Can not create a projection object!!!").toStdString());
}
m_projectionObject->Label.setValue(std::string(m_projectionObjectName.toUtf8()).c_str());
onRadioButtonShowAllClicked();
+5 -5
View File
@@ -625,7 +625,7 @@ Part::Box* SectionCut::tryCreateXBox(const Base::Vector3f& pos, const Base::Vect
return createXBox(pos, size);
}
catch (const Base::Exception& e) {
e.ReportException();
e.reportException();
return nullptr;
}
}
@@ -699,7 +699,7 @@ Part::Box* SectionCut::tryCreateYBox(const Base::Vector3f& pos, const Base::Vect
return createYBox(pos, size);
}
catch (const Base::Exception& e) {
e.ReportException();
e.reportException();
return nullptr;
}
}
@@ -743,7 +743,7 @@ Part::Box* SectionCut::tryCreateZBox(const Base::Vector3f& pos, const Base::Vect
return createZBox(pos, size);
}
catch (const Base::Exception& e) {
e.ReportException();
e.reportException();
return nullptr;
}
}
@@ -798,7 +798,7 @@ Part::Cut* SectionCut::tryCreateCut(const char* name)
return createCut(name);
}
catch (const Base::Exception& e) {
e.ReportException();
e.reportException();
return nullptr;
}
}
@@ -829,7 +829,7 @@ void SectionCut::startCutting(bool isInitial)
startObjectCutting(isInitial);
}
catch (const Base::Exception& e) {
e.ReportException();
e.reportException();
}
}
+1 -1
View File
@@ -97,7 +97,7 @@ void ShapeFromMesh::accept()
perform();
}
catch (const Base::Exception& e) {
e.ReportException();
e.reportException();
}
QDialog::accept();
+3 -3
View File
@@ -1200,11 +1200,11 @@ void TaskAttacher::visibilityAutomation(bool opening_not_closing)
visAutoFunc(opening_not_closing, ObjectName, ViewProvider, editObj, editSubName);
}
catch (const Base::Exception& e) {
e.ReportException();
e.reportException();
}
catch (const Py::Exception&) {
Base::PyException e;
e.ReportException();
e.reportException();
}
}
else {
@@ -1214,7 +1214,7 @@ void TaskAttacher::visibilityAutomation(bool opening_not_closing)
visAutoFunc(opening_not_closing, objName, nullptr, nullptr, std::string());
}
catch (Base::Exception& e) {
e.ReportException();
e.reportException();
}
}
}
+2 -2
View File
@@ -385,7 +385,7 @@ TaskCheckGeometryResults::~TaskCheckGeometryResults()
}
catch (const Py::Exception&) {
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
}
@@ -677,7 +677,7 @@ void TaskCheckGeometryResults::buildShapeContent(App::DocumentObject *pObject, c
}
catch (Py::Exception&) {
Base::PyException e;
e.ReportException();
e.reportException();
stream << baseName.toLatin1().data() << std::endl;
BRepTools_ShapeSet set;
set.Add(shape);
+1 -1
View File
@@ -94,7 +94,7 @@ App::DocumentObjectExecReturn* Feature::recompute()
}
catch (Base::Exception& e) {
failed = true;
e.ReportException();
e.reportException();
FC_ERR("Failed to recompute suppressed feature " << getFullName());
}
+1 -1
View File
@@ -2089,7 +2089,7 @@ App::DocumentObjectExecReturn* Hole::execute()
msg += std::to_string(i);
return new App::DocumentObjectExecReturn(msg.c_str());
} catch (Base::Exception &e) {
e.ReportException();
e.reportException();
std::string msg(QT_TRANSLATE_NOOP("Exception", "Boolean operation failed on profile Edge"));
msg += std::to_string(i);
return new App::DocumentObjectExecReturn(msg.c_str());
+4 -4
View File
@@ -389,7 +389,7 @@ SubShapeBinder::~SubShapeBinder() {
clearCopiedObjects();
}
catch (const Base::ValueError& e) {
e.ReportException();
e.reportException();
}
}
@@ -452,7 +452,7 @@ void SubShapeBinder::setupCopyOnChange() {
removeDynamicProperty(prop->getName());
}
catch (Base::Exception& e) {
e.ReportException();
e.reportException();
}
catch (...) {
}
@@ -678,7 +678,7 @@ void SubShapeBinder::update(SubShapeBinder::UpdateOption options) {
}
}
catch (Base::Exception& e) {
e.ReportException();
e.reportException();
FC_ERR(getFullName() << " failed to obtain shape from "
<< obj->getFullName() << '.' << sub);
if (errMsg.empty()) {
@@ -864,7 +864,7 @@ void SubShapeBinder::slotRecomputedObject(const App::DocumentObject& Obj) {
update();
}
catch (Base::Exception& e) {
e.ReportException();
e.reportException();
}
}
}
+2 -2
View File
@@ -405,7 +405,7 @@ void CmdPartDesignSubShapeBinder::activated(int iMsg)
updateActive();
commitCommand();
} catch (Base::Exception &e) {
e.ReportException();
e.reportException();
QMessageBox::critical(Gui::getMainWindow(),
QObject::tr("Sub-Shape Binder"), QApplication::translate("Exception", e.what()));
abortCommand();
@@ -1288,7 +1288,7 @@ void CmdPartDesignGroove::activated(int iMsg)
FCMD_OBJ_CMD(Feat,"Reversed = 1");
}
catch (const Base::Exception& e) {
e.ReportException();
e.reportException();
}
finishProfileBased(cmd, sketch, Feat);
@@ -289,7 +289,7 @@ TaskChamferParameters::~TaskChamferParameters()
}
catch (const Py::Exception&) {
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
}
@@ -268,7 +268,7 @@ TaskDraftParameters::~TaskDraftParameters()
}
catch (const Py::Exception&) {
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
}
@@ -169,7 +169,7 @@ void TaskDressUpParameters::addAllEdges(QListWidget* widget)
pcDressUp->Base.setValue(base, subValues);
}
catch (Base::Exception& e) {
e.ReportException();
e.reportException();
}
}
@@ -274,7 +274,7 @@ void TaskDressUpParameters::tryAddSelection(const std::string& doc,
Gui::Selection().addSelection(doc.c_str(), obj.c_str(), sub.c_str(), 0, 0, 0);
}
catch (const Base::Exception& e) {
e.ReportException();
e.reportException();
}
catch (const Standard_Failure& e) {
Base::Console().Error("OCC error: %s\n", e.GetMessageString());
@@ -334,7 +334,7 @@ void TaskExtrudeParameters::tryRecomputeFeature()
recomputeFeature();
}
catch (const Base::Exception& e) {
e.ReportException();
e.reportException();
}
}
+1 -1
View File
@@ -325,7 +325,7 @@ std::vector<App::DocumentObject*> TaskFeaturePick::buildFeatures()
}
}
catch (const Base::Exception& e) {
e.ReportException();
e.reportException();
}
catch (Py::Exception& e) {
// reported by code analyzers
@@ -172,7 +172,7 @@ TaskFilletParameters::~TaskFilletParameters()
}
catch (const Py::Exception&) {
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
}
@@ -177,7 +177,7 @@ void TaskHelixParameters::showCoordinateAxes()
vpOrigin->setTemporaryVisibility(Gui::DatumElement::Axes);
}
catch (const Base::Exception& ex) {
ex.ReportException();
ex.reportException();
}
}
}
@@ -239,7 +239,7 @@ void TaskHelixParameters::addPartAxes()
addAxisToCombo(orig->getZ(), "", tr("Base Z axis"));
}
catch (const Base::Exception& ex) {
ex.ReportException();
ex.reportException();
}
}
}
@@ -528,7 +528,7 @@ void TaskHelixParameters::onAxisChanged(int num)
updateStatus();
}
catch (const Base::Exception& e) {
e.ReportException();
e.reportException();
}
}
@@ -589,7 +589,7 @@ TaskHelixParameters::~TaskHelixParameters()
}
}
catch (const Base::Exception& ex) {
ex.ReportException();
ex.reportException();
}
}
@@ -542,7 +542,7 @@ TaskMultiTransformParameters::~TaskMultiTransformParameters()
}
catch (const Py::Exception&) {
Base::PyException exc; // extract the Python error text
exc.ReportException();
exc.reportException();
}
}
@@ -165,11 +165,11 @@ TaskPipeParameters::~TaskPipeParameters()
}
catch (const Base::Exception& e) {
// getDocument() may raise an exception
e.ReportException();
e.reportException();
}
catch (const Py::Exception&) {
Base::PyException e; // extract the Python error text
e.ReportException();
e.reportException();
}
}
@@ -104,7 +104,7 @@ TaskRevolutionParameters::TaskRevolutionParameters(PartDesignGui::ViewProvider*
}
}
catch (const Base::Exception &ex) {
ex.ReportException();
ex.reportException();
}
}
@@ -236,7 +236,7 @@ void TaskRevolutionParameters::fillAxisCombo(bool forceRefill)
addAxisToCombo(orig->getY(), std::string(), tr("Base Y axis"));
addAxisToCombo(orig->getZ(), std::string(), tr("Base Z axis"));
} catch (const Base::Exception &ex) {
ex.ReportException();
ex.reportException();
}
}
@@ -578,7 +578,7 @@ void TaskRevolutionParameters::onAxisChanged(int num)
recomputeFeature();
}
catch (const Base::Exception& e) {
e.ReportException();
e.reportException();
}
}
@@ -665,7 +665,7 @@ TaskRevolutionParameters::~TaskRevolutionParameters()
}
}
catch (const Base::Exception &ex) {
ex.ReportException();
ex.reportException();
}
axesInList.clear();

Some files were not shown because too many files have changed in this diff Show More