From bf4ace09579d4cfa6269143de6dafc9e6bcf0e22 Mon Sep 17 00:00:00 2001 From: bofdahof <172177156+bofdahof@users.noreply.github.com> Date: Tue, 18 Mar 2025 17:47:10 +1000 Subject: [PATCH 1/2] Base: simplify Exception Remove repetition. Add functions to replace macros, but keep macros in use for now as some compilers have broken std::source_location support. --- src/Base/Exception.cpp | 537 +++--------- src/Base/Exception.h | 869 +++++--------------- src/Base/Interpreter.cpp | 32 +- src/Mod/Part/Gui/DlgProjectionOnSurface.cpp | 4 +- 4 files changed, 354 insertions(+), 1088 deletions(-) diff --git a/src/Base/Exception.cpp b/src/Base/Exception.cpp index acbf6aa16c..45bbe65155 100644 --- a/src/Base/Exception.cpp +++ b/src/Base/Exception.cpp @@ -21,13 +21,15 @@ * * ***************************************************************************/ - #include "PreCompiled.h" +#ifndef _PreComp_ +#include +#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 { - 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(Py::String(edict.getItem("sfile"))); + fileName = Py::String(edict.getItem("sfile")); } if (edict.hasKey("sfunction")) { - _function = static_cast(Py::String(edict.getItem("sfunction"))); + functionName = Py::String(edict.getItem("sfunction")); } if (edict.hasKey("sErrMsg")) { - _sErrMsg = static_cast(Py::String(edict.getItem("sErrMsg"))); + errorMessage = Py::String(edict.getItem("sErrMsg")); } if (edict.hasKey("iline")) { - _line = static_cast(Py::Long(edict.getItem("iline"))); + lineNum = static_cast(Py::Long(edict.getItem("iline"))); } if (edict.hasKey("btranslatable")) { - _isTranslatable = static_cast(Py::Boolean(edict.getItem("btranslatable"))); + isTranslatable = static_cast(Py::Boolean(edict.getItem("btranslatable"))); } if (edict.hasKey("breported")) { - _isReported = static_cast(Py::Boolean(edict.getItem("breported"))); + hasBeenReported = static_cast(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; } } @@ -307,32 +249,26 @@ const char* FileException::what() const noexcept 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 #include +#include 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"); diff --git a/src/Base/Exception.h b/src/Base/Exception.h index 2ebdd78744..047ea54cb9 100644 --- a/src/Base/Exception.h +++ b/src/Base/Exception.h @@ -21,172 +21,126 @@ * * ***************************************************************************/ - #ifndef BASE_EXCEPTION_H #define BASE_EXCEPTION_H #include +#include #include + #include "BaseClass.h" #include "FileInfo.h" +using PyObject = struct _object; // NOLINT -using PyObject = struct _object; +// Remove once all used compilers support this +#if defined(__cpp_lib_source_location) +#define HAVE_STD_SOURCE_LOCATION 1 +#else +#undef HAVE_STD_SOURCE_LOCATION +#endif +// std::source_location is implemented, but buggy in Clang 15 +#if defined(__clang__) && __clang_major__ <= 15 +#undef HAVE_STD_SOURCE_LOCATION +#endif -/* MACROS FOR THROWING EXCEPTIONS */ - -/// the macros do NOT mark any message for translation +/// The macros do NOT mark any message for translation /// If you want to mark text for translation, use the QT_TRANSLATE_NOOP macro -/// with the context "Exceptions" and the right throwing macro from below (the one ending in T) +/// with the context "Exceptions" and the right throwing macro from below (the one ending with T) /// example: /// THROWMT(Base::ValueError,QT_TRANSLATE_NOOP("Exceptions","The multiplicity cannot be increased /// beyond the degree of the B-Spline.")); /// /// N.B.: The QT_TRANSLATE_NOOP macro won't translate your string. It will just allow lupdate to /// identify that string for translation so that if you ask for a translation (and the translator -/// have provided one) at that time it gets translated (e.g. in the UI before showing the message of -/// the exception). +/// have provided one) at that time it gets translated (e.g. in the UI before showing the message +/// of the exception). -// NOLINTBEGIN -#ifdef _MSC_VER - -#define THROW(exception) \ - { \ - exception myexcp; \ - myexcp.setDebugInformation(__FILE__, __LINE__, __FUNCSIG__); \ - throw myexcp; \ - } -#define THROWM(exception, message) \ - { \ - exception myexcp(message); \ - myexcp.setDebugInformation(__FILE__, __LINE__, __FUNCSIG__); \ - throw myexcp; \ - } -#define THROWMF_FILEEXCEPTION(message, filenameorfileinfo) \ - { \ - FileException myexcp(message, filenameorfileinfo); \ - myexcp.setDebugInformation(__FILE__, __LINE__, __FUNCSIG__); \ - throw myexcp; \ - } - -#define THROWT(exception) \ - { \ - exception myexcp; \ - myexcp.setDebugInformation(__FILE__, __LINE__, __FUNCSIG__); \ - myexcp.setTranslatable(true); \ - throw myexcp; \ - } -#define THROWMT(exception, message) \ - { \ - exception myexcp(message); \ - myexcp.setDebugInformation(__FILE__, __LINE__, __FUNCSIG__); \ - myexcp.setTranslatable(true); \ - throw myexcp; \ - } -#define THROWMFT_FILEEXCEPTION(message, filenameorfileinfo) \ - { \ - FileException myexcp(message, filenameorfileinfo); \ - myexcp.setDebugInformation(__FILE__, __LINE__, __FUNCSIG__); \ - myexcp.setTranslatable(true); \ - throw myexcp; \ - } - -#elif defined(__GNUC__) - -#define THROW(exception) \ - { \ - exception myexcp; \ - myexcp.setDebugInformation(__FILE__, __LINE__, __PRETTY_FUNCTION__); \ - throw myexcp; \ - } -#define THROWM(exception, message) \ - { \ - exception myexcp(message); \ - myexcp.setDebugInformation(__FILE__, __LINE__, __PRETTY_FUNCTION__); \ - throw myexcp; \ - } -#define THROWMF_FILEEXCEPTION(message, filenameorfileinfo) \ - { \ - FileException myexcp(message, filenameorfileinfo); \ - myexcp.setDebugInformation(__FILE__, __LINE__, __PRETTY_FUNCTION__); \ - throw myexcp; \ - } - -#define THROWT(exception) \ - { \ - exception myexcp; \ - myexcp.setDebugInformation(__FILE__, __LINE__, __PRETTY_FUNCTION__); \ - myexcp.setTranslatable(true); \ - throw myexcp; \ - } -#define THROWMT(exception, message) \ - { \ - exception myexcp(message); \ - myexcp.setDebugInformation(__FILE__, __LINE__, __PRETTY_FUNCTION__); \ - myexcp.setTranslatable(true); \ - throw myexcp; \ - } -#define THROWMFT_FILEEXCEPTION(message, filenameorfileinfo) \ - { \ - FileException myexcp(message, filenameorfileinfo); \ - myexcp.setDebugInformation(__FILE__, __LINE__, __PRETTY_FUNCTION__); \ - myexcp.setTranslatable(true); \ - throw myexcp; \ - } - -#else - -#define THROW(exception) \ - { \ - exception myexcp; \ - myexcp.setDebugInformation(__FILE__, __LINE__, __func__); \ - throw myexcp; \ - } -#define THROWM(exception, message) \ - { \ - exception myexcp(message); \ - myexcp.setDebugInformation(__FILE__, __LINE__, __func__); \ - throw myexcp; \ - } -#define THROWMF_FILEEXCEPTION(message, filenameorfileinfo) \ - { \ - FileException myexcp(message, filenameorfileinfo); \ - myexcp.setDebugInformation(__FILE__, __LINE__, __func__); \ - throw myexcp; \ - } - -#define THROWT(exception) \ - { \ - exception myexcp; \ - myexcp.setDebugInformation(__FILE__, __LINE__, __func__); \ - myexcp.setTranslatable(true); \ - throw myexcp; \ - } -#define THROWMT(exception, message) \ - { \ - exception myexcp(message); \ - myexcp.setDebugInformation(__FILE__, __LINE__, __func__); \ - myexcp.setTranslatable(true); \ - throw myexcp; \ - } -#define THROWMFT_FILEEXCEPTION(message, filenameorfileinfo) \ - { \ - FileException myexcp(message, filenameorfileinfo); \ - myexcp.setDebugInformation(__FILE__, __LINE__, __func__); \ - myexcp.setTranslatable(true); \ - throw myexcp; \ - } - - -#endif - -#define FC_THROWM(_exception, _msg) \ +#if defined(HAVE_STD_SOURCE_LOCATION) +// NOLINTBEGIN(*-macro-usage) +#define THROWM(exc, msg) Base::setupAndThrowException((msg), std::source_location::current()); +#define THROWMT(exc, msg) \ + Base::setupAndThrowException((msg), std::source_location::current(), true); +#define FC_THROWM(exception, msg) \ do { \ std::stringstream ss; \ - ss << _msg; \ - THROWM(_exception, ss.str().c_str()); \ + ss << msg; \ + THROWM(exception, ss.str()); \ } while (0) -// NOLINTEND +// NOLINTEND(*-macro-usage) + +namespace Base +{ +template +[[noreturn]] void setupAndThrowException(const std::string message, + const std::source_location location, + const bool translatable = false) +{ + ExceptionType exception {message}; + exception.setTranslatable(translatable); + exception.setDebugInformation(location); + throw exception; +} // NOLINT // unreachable +} // namespace Base + +#else // HAVE_STD_SOURCE_LOCATION + +#ifdef _MSC_VER +#define FC_THROW_INFO __FILE__, __LINE__, __FUNCSIG__ +#elif __GNUC__ +#define FC_THROW_INFO __FILE__, __LINE__, __PRETTY_FUNCTION__ +#else +#define FC_THROW_INFO __FILE__, __LINE__, __func__ +#endif + +#define THROWM(exc, msg) Base::setupAndThrowException(msg, FC_THROW_INFO); +#define THROWMT(exc, msg) Base::setupAndThrowException(msg, FC_THROW_INFO, true); +#define FC_THROWM(exception, msg) \ + do { \ + std::stringstream ss; \ + ss << msg; \ + THROWM(exception, ss.str()); \ + } while (0) +namespace Base +{ +template +[[noreturn]] void setupAndThrowException(const std::string message, + const char* file, + const int line, + const char* func, + const bool translatable = false) +{ + ExceptionType exception {message}; + exception.setTranslatable(translatable); + exception.setDebugInformation(file, line, func); + throw exception; +} // NOLINT // unreachable +} // namespace Base + +#endif // HAVE_STD_SOURCE_LOCATION + +//-------------------------------------------------------------------------------------------------- + +template +constexpr void THROWM_(const std::string& msg, + const std::source_location location = std::source_location::current()) +{ + Base::setupAndThrowException(msg, location); +} + +template +constexpr void THROWMT_(const std::string& msg, + const std::source_location location = std::source_location::current()) +{ + Base::setupAndThrowException(msg, location, true); +} + +template +constexpr void FC_THROWM_(const std::string& raw_msg, + const std::source_location location = std::source_location::current()) +{ + THROWM_(raw_msg, location); +} namespace Base { @@ -196,18 +150,16 @@ class BaseExport Exception: public BaseClass TYPESYSTEM_HEADER_WITH_OVERRIDE(); public: + explicit Exception(std::string message = "FreeCAD Exception"); ~Exception() noexcept override = default; Exception& operator=(const Exception& inst); Exception& operator=(Exception&& inst) noexcept; virtual const char* what() const noexcept; + virtual void ReportException() const; // once only - /// Reports exception. It includes a mechanism to only report an exception once. - virtual void ReportException() const; - - inline void setMessage(const char* sMessage); - inline void setMessage(const std::string& sMessage); + inline void setMessage(const std::string& message); // what may differ from the message given by the user in // derived classes inline std::string getMessage() const; @@ -215,212 +167,104 @@ public: inline int getLine() const; inline std::string getFunction() const; inline bool getTranslatable() const; - inline bool getReported() const - { - return _isReported; - } + inline bool getReported() const; + inline void setReported(bool reported) const; - /// setter methods for including debug information - /// intended to use via macro for autofilling of debugging information - inline void setDebugInformation(const std::string& file, int line, const std::string& function); +#if defined(HAVE_STD_SOURCE_LOCATION) + inline void setDebugInformation(const std::source_location& location); +#else + inline void setDebugInformation(const char* file, int line, const char* func); +#endif inline void setTranslatable(bool translatable); - inline void setReported(bool reported) - { - _isReported = reported; - } + PyObject* getPyObject() override; // exception data + void setPyObject(PyObject* pydict) override; // set the exception data - /// returns a Python dictionary containing the exception data - PyObject* getPyObject() override; - /// returns sets the exception data from a Python dictionary - void setPyObject(PyObject* pydict) override; - - /// returns the corresponding python exception type virtual PyObject* getPyExceptionType() const; - /// Sets the Python error indicator and an error message virtual void setPyException() const; protected: - /* sMessage may be: - * - a UI compliant string susceptible to being translated and shown to the user in the UI - * - a very technical message not intended to be translated or shown to the user in the UI - * The preferred way of throwing an exception is using the macros above. - * This way, the file, line, and function are automatically inserted. */ - explicit Exception(const char* sMessage); - explicit Exception(std::string sMessage); - Exception(); Exception(const Exception& inst); Exception(Exception&& inst) noexcept; -protected: - std::string _sErrMsg; - std::string _file; - int _line; - std::string _function; - bool _isTranslatable; - mutable bool _isReported; +private: + std::string errorMessage; + std::string fileName; + int lineNum {0}; + std::string functionName; + bool isTranslatable {false}; + mutable bool hasBeenReported {false}; }; - -/** - * The AbortException is thrown if a pending operation was aborted. - * @author Werner Mayer - */ class BaseExport AbortException: public Exception { TYPESYSTEM_HEADER_WITH_OVERRIDE(); public: - /// Construction - explicit AbortException(const char* sMessage); - /// Construction - AbortException(); - AbortException(const AbortException&) = default; - AbortException(AbortException&&) = default; + explicit AbortException(const std::string& message = "Aborted operation"); - /// Destruction - ~AbortException() noexcept override = default; - AbortException& operator=(const AbortException&) = default; - AbortException& operator=(AbortException&&) = default; - - /// Description of the exception const char* what() const noexcept override; - /// returns the corresponding python exception type PyObject* getPyExceptionType() const override; }; -/** - * The XMLBaseException can be used to indicate any kind of XML related errors. - * @author Werner Mayer - */ class BaseExport XMLBaseException: public Exception { public: - /// Construction - XMLBaseException(); - explicit XMLBaseException(const char* sMessage); - explicit XMLBaseException(const std::string& sMessage); - XMLBaseException(const XMLBaseException&) = default; - XMLBaseException(XMLBaseException&&) = default; - - /// Destruction - ~XMLBaseException() noexcept override = default; - XMLBaseException& operator=(const XMLBaseException&) = default; - XMLBaseException& operator=(XMLBaseException&&) = default; + explicit XMLBaseException(const std::string& message = "XML base exception"); PyObject* getPyExceptionType() const override; }; -/** - * The XMLParseException is thrown if parsing an XML failed. - * @author Werner Mayer - */ class BaseExport XMLParseException: public XMLBaseException { public: - /// Construction - explicit XMLParseException(const char* sMessage); - /// Construction - explicit XMLParseException(const std::string& sMessage); - /// Construction - XMLParseException(); - XMLParseException(const XMLParseException&) = default; - XMLParseException(XMLParseException&&) = default; + explicit XMLParseException(const std::string& message = "XML parse exception"); - /// Destruction - ~XMLParseException() noexcept override = default; - XMLParseException& operator=(const XMLParseException&) = default; - XMLParseException& operator=(XMLParseException&&) = default; - - /// Description of the exception const char* what() const noexcept override; PyObject* getPyExceptionType() const override; }; -/** - * The XMLAttributeError is thrown if a requested attribute doesn't exist. - * @author Werner Mayer - */ class BaseExport XMLAttributeError: public XMLBaseException { public: - /// Construction - explicit XMLAttributeError(const char* sMessage); - /// Construction - explicit XMLAttributeError(const std::string& sMessage); - /// Construction - XMLAttributeError(); - XMLAttributeError(const XMLAttributeError&) = default; - XMLAttributeError(XMLAttributeError&&) = default; + explicit XMLAttributeError(const std::string& message = "XML attribute error"); - /// Destruction - ~XMLAttributeError() noexcept override = default; - XMLAttributeError& operator=(const XMLAttributeError&) = default; - XMLAttributeError& operator=(XMLAttributeError&&) = default; - - /// Description of the exception const char* what() const noexcept override; PyObject* getPyExceptionType() const override; }; -/** File exception handling class - * This class is specialized to go with exception thrown in case of File IO Problems. - * @author Juergen Riegel - */ class BaseExport FileException: public Exception { public: - /// With massage and file name - explicit FileException(const char* sMessage, const char* sFileName = nullptr); - /// With massage and file name - FileException(const char* sMessage, const FileInfo& File); - /// standard construction - FileException(); - FileException(const FileException&) = default; - FileException(FileException&&) = default; - /// Destruction - ~FileException() noexcept override = default; - /// Assignment operator - FileException& operator=(const FileException&) = default; - FileException& operator=(FileException&&) = default; + explicit FileException(const std::string& message = "Unknown file exception happened", + const std::string& fileName = ""); + FileException(const std::string& message, const FileInfo& File); - /// Description of the exception const char* what() const noexcept override; - /// Report generation void ReportException() const override; - /// Get file name for use with translatable message std::string getFileName() const; - /// returns a Python dictionary containing the exception data PyObject* getPyObject() override; - /// returns sets the exception data from a Python dictionary + void setPyObject(PyObject* pydict) override; PyObject* getPyExceptionType() const override; -protected: +private: FileInfo file; // necessary for what() legacy behaviour as it returns a buffer that // can not be of a temporary object to be destroyed at end of what() std::string _sErrMsgAndFileName; - void setFileName(const char* sFileName = nullptr); + void setFileName(const std::string& fileName); }; -/** - * The FileSystemError can be used to indicate errors on file system - * e.g. if renaming of a file failed. - * @author Werner Mayer - */ class BaseExport FileSystemError: public Exception { public: - /// Construction - FileSystemError(); - explicit FileSystemError(const char* sMessage); - explicit FileSystemError(const std::string& sMessage); + explicit FileSystemError(const std::string& message = "File system error"); FileSystemError(const FileSystemError&) = default; FileSystemError(FileSystemError&&) = default; - /// Destruction + ~FileSystemError() noexcept override = default; FileSystemError& operator=(const FileSystemError&) = default; FileSystemError& operator=(FileSystemError&&) = default; @@ -428,580 +272,267 @@ public: PyObject* getPyExceptionType() const override; }; -/** - * The BadFormatError can be used to indicate errors in a data structure. - * @author Werner Mayer - */ +/** errors in a data structure */ class BaseExport BadFormatError: public Exception { public: - /// Construction - BadFormatError(); - explicit BadFormatError(const char* sMessage); - explicit BadFormatError(const std::string& sMessage); + explicit BadFormatError(const std::string& message = "Bad format error"); BadFormatError(const BadFormatError&) = default; BadFormatError(BadFormatError&&) = default; - /// Destruction + ~BadFormatError() noexcept override = default; BadFormatError& operator=(const BadFormatError&) = default; BadFormatError& operator=(BadFormatError&&) = default; PyObject* getPyExceptionType() const override; }; -/** - * The MemoryException is thrown if not enough memory can be allocated. - * @author Werner Mayer - */ #if defined(__GNUC__) -// It seems that the calling instance of our new handler expects a bad_alloc exception +// calling instance of our new handler expects a bad_alloc exception class BaseExport MemoryException: public Exception, virtual public std::bad_alloc #else class BaseExport MemoryException: public Exception #endif { public: - /// Construction - MemoryException(); - /// Construction - MemoryException(const MemoryException& inst); - MemoryException(MemoryException&& inst) noexcept; - /// Destruction - ~MemoryException() noexcept override = default; - /// Assignment operator - MemoryException& operator=(const MemoryException& inst); - MemoryException& operator=(MemoryException&& inst) noexcept; + explicit MemoryException(const std::string& = "Not enough memory available"); + #if defined(__GNUC__) - /// Description of the exception const char* what() const noexcept override; #endif + PyObject* getPyExceptionType() const override; }; -/** - * The AccessViolation can be used in an own signal handler. - * @author Werner Mayer - */ +/** can be used in an own signal handler */ class BaseExport AccessViolation: public Exception { public: - /// Construction - AccessViolation(); - explicit AccessViolation(const char* sMessage); - explicit AccessViolation(const std::string& sMessage); - AccessViolation(const AccessViolation&) = default; - AccessViolation(AccessViolation&&) = default; - /// Destruction - ~AccessViolation() noexcept override = default; - AccessViolation& operator=(const AccessViolation&) = default; - AccessViolation& operator=(AccessViolation&&) = default; + explicit AccessViolation(const std::string& message = "Access violation"); PyObject* getPyExceptionType() const override; }; -/** - * The AbnormalProgramTermination can be used in an own signal handler. - * @author Werner Mayer - */ +/** can be used in an own signal handler */ class BaseExport AbnormalProgramTermination: public Exception { public: - /// Construction - AbnormalProgramTermination(); - /// Construction - explicit AbnormalProgramTermination(const char* sMessage); - explicit AbnormalProgramTermination(const std::string& sMessage); - AbnormalProgramTermination(const AbnormalProgramTermination&) = default; - AbnormalProgramTermination(AbnormalProgramTermination&&) = default; - /// Destruction - ~AbnormalProgramTermination() noexcept override = default; - AbnormalProgramTermination& operator=(const AbnormalProgramTermination&) = default; - AbnormalProgramTermination& operator=(AbnormalProgramTermination&&) = default; + explicit AbnormalProgramTermination( + const std::string& message = "Abnormal program termination"); PyObject* getPyExceptionType() const override; }; -/** - * The UnknownProgramOption can be used to indicate an unknown program option. - * @author Werner Mayer - */ class BaseExport UnknownProgramOption: public Exception { public: - /// Construction - UnknownProgramOption(); - explicit UnknownProgramOption(const char* sMessage); - explicit UnknownProgramOption(const std::string& sMessage); - UnknownProgramOption(const UnknownProgramOption&) = default; - UnknownProgramOption(UnknownProgramOption&&) = default; - /// Destruction - ~UnknownProgramOption() noexcept override = default; - UnknownProgramOption& operator=(const UnknownProgramOption&) = default; - UnknownProgramOption& operator=(UnknownProgramOption&&) = default; + explicit UnknownProgramOption(const std::string& message = "Unknown program option"); PyObject* getPyExceptionType() const override; }; -/** - * The ProgramInformation can be used to show information about the program. - * @author Werner Mayer - */ class BaseExport ProgramInformation: public Exception { public: - /// Construction - ProgramInformation(); - explicit ProgramInformation(const char* sMessage); - explicit ProgramInformation(const std::string& sMessage); - ProgramInformation(const ProgramInformation&) = default; - ProgramInformation(ProgramInformation&&) = default; - - /// Destruction - ~ProgramInformation() noexcept override = default; - ProgramInformation& operator=(const ProgramInformation&) = default; - ProgramInformation& operator=(ProgramInformation&&) = default; + explicit ProgramInformation(const std::string& message = "Program information"); }; -/** - * The TypeError can be used to indicate the usage of a wrong type. - * @author Werner Mayer - */ class BaseExport TypeError: public Exception { public: - /// Construction - TypeError(); - explicit TypeError(const char* sMessage); - explicit TypeError(const std::string& sMessage); - TypeError(const TypeError&) = default; - TypeError(TypeError&&) = default; - /// Destruction - ~TypeError() noexcept override = default; - TypeError& operator=(const TypeError&) = default; - TypeError& operator=(TypeError&&) = default; + explicit TypeError(const std::string& message = "Type error"); PyObject* getPyExceptionType() const override; }; -/** - * The ValueError can be used to indicate the usage of a wrong value. - * @author Werner Mayer - */ class BaseExport ValueError: public Exception { public: - /// Construction - ValueError(); - explicit ValueError(const char* sMessage); - explicit ValueError(const std::string& sMessage); - ValueError(const ValueError&) = default; - ValueError(ValueError&&) = default; - /// Destruction - ~ValueError() noexcept override = default; - ValueError& operator=(const ValueError&) = default; - ValueError& operator=(ValueError&&) = default; + explicit ValueError(const std::string& message = "Value error"); PyObject* getPyExceptionType() const override; }; -/** - * The IndexError can be used when a sequence subscript is out of range. - * @author Werner Mayer - */ +/** sequence subscript is out of range */ class BaseExport IndexError: public Exception { public: - /// Construction - IndexError(); - explicit IndexError(const char* sMessage); - explicit IndexError(const std::string& sMessage); - IndexError(const IndexError&) = default; - IndexError(IndexError&&) = default; - /// Destruction - ~IndexError() noexcept override = default; - IndexError& operator=(const IndexError&) = default; - IndexError& operator=(IndexError&&) = default; + explicit IndexError(const std::string& message = "Index error"); PyObject* getPyExceptionType() const override; }; class BaseExport NameError: public Exception { public: - /// Construction - NameError(); - explicit NameError(const char* sMessage); - explicit NameError(const std::string& sMessage); - NameError(const NameError&) = default; - NameError(NameError&&) = default; - /// Destruction - ~NameError() noexcept override = default; - NameError& operator=(const NameError&) = default; - NameError& operator=(NameError&&) = default; + explicit NameError(const std::string& message = "Name error"); PyObject* getPyExceptionType() const override; }; class BaseExport ImportError: public Exception { public: - /// Construction - ImportError(); - explicit ImportError(const char* sMessage); - explicit ImportError(const std::string& sMessage); - ImportError(const ImportError&) = default; - ImportError(ImportError&&) = default; - /// Destruction - ~ImportError() noexcept override = default; - ImportError& operator=(const ImportError&) = default; - ImportError& operator=(ImportError&&) = default; + explicit ImportError(const std::string& message = "Import error"); PyObject* getPyExceptionType() const override; }; -/** - * The AttributeError can be used to indicate the usage of a wrong value. - * @author Werner Mayer - */ class BaseExport AttributeError: public Exception { public: - /// Construction - AttributeError(); - explicit AttributeError(const char* sMessage); - explicit AttributeError(const std::string& sMessage); - AttributeError(const AttributeError&) = default; - AttributeError(AttributeError&&) = default; - /// Destruction - ~AttributeError() noexcept override = default; - AttributeError& operator=(const AttributeError&) = default; - AttributeError& operator=(AttributeError&&) = default; + explicit AttributeError(const std::string& message = "Attribute error"); PyObject* getPyExceptionType() const override; }; -/** - * The PropertyError can be used to indicate the usage of a wrong property name or value. - * @author Mario Passaglia - */ class BaseExport PropertyError: public AttributeError { public: - /// Construction - PropertyError(); - explicit PropertyError(const char* sMessage); - explicit PropertyError(const std::string& sMessage); - PropertyError(const PropertyError&) = default; - PropertyError(PropertyError&&) = default; - /// Destruction - ~PropertyError() noexcept override = default; - PropertyError& operator=(const PropertyError&) = default; - PropertyError& operator=(PropertyError&&) = default; + explicit PropertyError(const std::string& message = "Property error"); PyObject* getPyExceptionType() const override; }; -/** - * The RuntimeError can be used to indicate an unknown exception at runtime. - * @author Werner Mayer - */ class BaseExport RuntimeError: public Exception { public: - /// Construction - RuntimeError(); - explicit RuntimeError(const char* sMessage); - explicit RuntimeError(const std::string& sMessage); - RuntimeError(const RuntimeError&) = default; - RuntimeError(RuntimeError&&) = default; - /// Destruction - ~RuntimeError() noexcept override = default; - RuntimeError& operator=(const RuntimeError&) = default; - RuntimeError& operator=(RuntimeError&&) = default; + explicit RuntimeError(const std::string& message = "Runtime error"); PyObject* getPyExceptionType() const override; }; -/** - * The BadGraphError can be used to indicate that a graph is e.g. not a DAG. - * @author Werner Mayer - */ class BaseExport BadGraphError: public RuntimeError { public: - /// Construction - BadGraphError(); - explicit BadGraphError(const char* sMessage); - explicit BadGraphError(const std::string& sMessage); - BadGraphError(const BadGraphError&) = default; - BadGraphError(BadGraphError&&) = default; - /// Destruction - ~BadGraphError() noexcept override = default; - BadGraphError& operator=(const BadGraphError&) = default; - BadGraphError& operator=(BadGraphError&&) = default; + explicit BadGraphError(const std::string& message = "Bad graph error"); PyObject* getPyExceptionType() const override; }; -/** - * The NotImplementedError can be used to indicate that an invoked function is not implemented. - * @author Werner Mayer - */ class BaseExport NotImplementedError: public Exception { public: - /// Construction - NotImplementedError(); - explicit NotImplementedError(const char* sMessage); - explicit NotImplementedError(const std::string& sMessage); - NotImplementedError(const NotImplementedError&) = default; - NotImplementedError(NotImplementedError&&) = default; - /// Destruction - ~NotImplementedError() noexcept override = default; - NotImplementedError& operator=(const NotImplementedError&) = default; - NotImplementedError& operator=(NotImplementedError&&) = default; + explicit NotImplementedError(const std::string& message = "Not implemented error"); PyObject* getPyExceptionType() const override; }; -/** - * The ZeroDivisionError can be used to indicate a division by zero. - * @author Werner Mayer - */ class BaseExport ZeroDivisionError: public Exception { public: - /// Construction - ZeroDivisionError(); - explicit ZeroDivisionError(const char* sMessage); - explicit ZeroDivisionError(const std::string& sMessage); - ZeroDivisionError(const ZeroDivisionError&) = default; - ZeroDivisionError(ZeroDivisionError&&) = default; - /// Destruction - ~ZeroDivisionError() noexcept override = default; - ZeroDivisionError& operator=(const ZeroDivisionError&) = default; - ZeroDivisionError& operator=(ZeroDivisionError&&) = default; + explicit ZeroDivisionError(const std::string& message = "Zero division error"); PyObject* getPyExceptionType() const override; }; -/** - * The ReferenceError can be used to indicate a reference counter has the wrong value. - * @author Werner Mayer - */ class BaseExport ReferenceError: public Exception { public: - /// Construction - ReferenceError(); - explicit ReferenceError(const char* sMessage); - explicit ReferenceError(const std::string& sMessage); - ReferenceError(const ReferenceError&) = default; - ReferenceError(ReferenceError&&) = default; - /// Destruction - ~ReferenceError() noexcept override = default; - ReferenceError& operator=(const ReferenceError&) = default; - ReferenceError& operator=(ReferenceError&&) = default; + explicit ReferenceError(const std::string& message = "Reference error"); PyObject* getPyExceptionType() const override; }; -/** - * The ExpressionError can be used to indicate erroneous.input - * to the expression engine. - * @author Werner Mayer - */ class BaseExport ExpressionError: public Exception { public: - /// Construction - ExpressionError(); - explicit ExpressionError(const char* sMessage); - explicit ExpressionError(const std::string& sMessage); - ExpressionError(const ExpressionError&) = default; - ExpressionError(ExpressionError&&) = default; - /// Destruction - ~ExpressionError() noexcept override = default; - ExpressionError& operator=(const ExpressionError&) = default; - ExpressionError& operator=(ExpressionError&&) = default; + explicit ExpressionError(const std::string& message = "Expression error"); PyObject* getPyExceptionType() const override; }; -/** - * The ParserError can be used to indicate the parsing error. - * @author Werner Mayer - */ class BaseExport ParserError: public Exception { public: - /// Construction - ParserError(); - explicit ParserError(const char* sMessage); - explicit ParserError(const std::string& sMessage); - ParserError(const ParserError&) = default; - ParserError(ParserError&&) = default; - /// Destruction - ~ParserError() noexcept override = default; - ParserError& operator=(const ParserError&) = default; - ParserError& operator=(ParserError&&) = default; + explicit ParserError(const std::string& message = "Parser error"); PyObject* getPyExceptionType() const override; }; -/** - * The UnicodeError can be used to indicate unicode encoding/decoding error. - * @author Werner Mayer - */ class BaseExport UnicodeError: public Exception { public: - /// Construction - UnicodeError(); - explicit UnicodeError(const char* sMessage); - explicit UnicodeError(const std::string& sMessage); - UnicodeError(const UnicodeError&) = default; - UnicodeError(UnicodeError&&) = default; - /// Destruction - ~UnicodeError() noexcept override = default; - UnicodeError& operator=(const UnicodeError&) = default; - UnicodeError& operator=(UnicodeError&&) = default; + explicit UnicodeError(const std::string& message = "Unicode error"); PyObject* getPyExceptionType() const override; }; -/** - * The OverflowError can be used to indicate overflows of numbers. - * @author Werner Mayer - */ class BaseExport OverflowError: public Exception { public: - /// Construction - OverflowError(); - explicit OverflowError(const char* sMessage); - explicit OverflowError(const std::string& sMessage); - OverflowError(const OverflowError&) = default; - OverflowError(OverflowError&&) = default; - /// Destruction - ~OverflowError() noexcept override = default; - OverflowError& operator=(const OverflowError&) = default; - OverflowError& operator=(OverflowError&&) = default; + explicit OverflowError(const std::string& message = "Overflow error"); PyObject* getPyExceptionType() const override; }; -/** - * The UnderflowError can be used to indicate underflows of numbers. - * @author Werner Mayer - */ class BaseExport UnderflowError: public Exception { public: - /// Construction - UnderflowError(); - explicit UnderflowError(const char* sMessage); - explicit UnderflowError(const std::string& sMessage); - UnderflowError(const UnderflowError&) = default; - UnderflowError(UnderflowError&&) = default; - /// Destruction - ~UnderflowError() noexcept override = default; - UnderflowError& operator=(const UnderflowError&) = default; - UnderflowError& operator=(UnderflowError&&) = default; + explicit UnderflowError(const std::string& message = "Underflow error"); PyObject* getPyExceptionType() const override; }; -/** - * The UnitsMismatchError can be used to indicate that quantities with different units are used. - * @author Werner Mayer - */ class BaseExport UnitsMismatchError: public Exception { public: - /// Construction - UnitsMismatchError(); - explicit UnitsMismatchError(const char* sMessage); - explicit UnitsMismatchError(const std::string& sMessage); - UnitsMismatchError(const UnitsMismatchError&) = default; - UnitsMismatchError(UnitsMismatchError&&) = default; - /// Destruction - ~UnitsMismatchError() noexcept override = default; - UnitsMismatchError& operator=(const UnitsMismatchError&) = default; - UnitsMismatchError& operator=(UnitsMismatchError&&) = default; + explicit UnitsMismatchError(const std::string& message = "Units mismatch error"); PyObject* getPyExceptionType() const override; }; -/* The CADKernelError can be used to indicate an exception originating in the CAD Kernel - * allowing to propagate the error messages of, for example, OCC Standard_Failure exception to - * the FreeCAD application without making the FreeCAD application depend on OCC. - * @author Abdullah Tahiri - */ class BaseExport CADKernelError: public Exception { public: - /// Construction - CADKernelError(); - explicit CADKernelError(const char* sMessage); - explicit CADKernelError(const std::string& sMessage); - CADKernelError(const CADKernelError&) = default; - CADKernelError(CADKernelError&&) = default; - /// Destruction - ~CADKernelError() noexcept override = default; - CADKernelError& operator=(const CADKernelError&) = default; - CADKernelError& operator=(CADKernelError&&) = default; + explicit CADKernelError(const std::string& message = "CAD kernel error"); PyObject* getPyExceptionType() const override; }; -/* The RestoreError can be used to try to do a best recovery effort when an error during restoring - * occurs. The best recovery effort may be to ignore the element altogether or to insert a - * placeholder depending on where the actual element being restored is used. - * - * For example, if it is part of an array (e.g. PropertyList) and the order in the array is - * relevant, it is better to have a placeholder than to fail to restore the whole array. - */ class BaseExport RestoreError: public Exception { public: - /// Construction - RestoreError(); - explicit RestoreError(const char* sMessage); - explicit RestoreError(const std::string& sMessage); - RestoreError(const RestoreError&) = default; - RestoreError(RestoreError&&) = default; - /// Destruction - ~RestoreError() noexcept override = default; - RestoreError& operator=(const RestoreError&) = default; - RestoreError& operator=(RestoreError&&) = default; + explicit RestoreError(const std::string& message = "Restore error"); PyObject* getPyExceptionType() const override; }; - -inline void Exception::setMessage(const char* sMessage) +inline void Exception::setMessage(const std::string& message) { - _sErrMsg = sMessage; -} - -inline void Exception::setMessage(const std::string& sMessage) -{ - _sErrMsg = sMessage; + errorMessage = message; } inline std::string Exception::getMessage() const { - return _sErrMsg; + return errorMessage; } inline std::string Exception::getFile() const { - return _file; + return fileName; } inline int Exception::getLine() const { - return _line; + return lineNum; } inline std::string Exception::getFunction() const { - return _function; + return functionName; } inline bool Exception::getTranslatable() const { - return _isTranslatable; + return isTranslatable; } -inline void -Exception::setDebugInformation(const std::string& file, int line, const std::string& function) +inline bool Exception::getReported() const { - _file = file; - _line = line; - _function = function; + return hasBeenReported; } -inline void Exception::setTranslatable(bool translatable) +inline void Exception::setReported(const bool reported) const { - _isTranslatable = translatable; + hasBeenReported = reported; +} + +#if defined(HAVE_STD_SOURCE_LOCATION) +inline void Exception::setDebugInformation(const std::source_location& location) +{ + fileName = location.file_name(); + lineNum = static_cast(location.line()); + functionName = location.function_name(); +} +#else +inline void Exception::setDebugInformation(const char* file, int line, const char* func) +{ + fileName = file; + lineNum = line; + functionName = func; +} +#endif + +inline void Exception::setTranslatable(const bool translatable) +{ + isTranslatable = translatable; } #if defined(__GNUC__) && defined(FC_OS_LINUX) @@ -1014,11 +545,9 @@ public: private: static void throw_signal(int signum); -private: - // clang-format off - struct sigaction new_action {}, old_action {}; + struct sigaction new_action {}; // NOLINT (keep struct) + struct sigaction old_action {}; // NOLINT (keep struct) bool ok {false}; - // clang-format on }; #endif diff --git a/src/Base/Interpreter.cpp b/src/Base/Interpreter.cpp index de026dd469..7cc9765b7d 100644 --- a/src/Base/Interpreter.cpp +++ b/src/Base/Interpreter.cpp @@ -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 @@ -106,17 +106,17 @@ 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; } @@ -125,16 +125,16 @@ void PyException::raiseException() 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; } @@ -656,7 +656,7 @@ std::string InterpreterSingleton::init(int argc, char* argv[]) } return getPythonPath(); } - catch (const Base::Exception& e) { + catch (const Exception& e) { e.ReportException(); throw; } diff --git a/src/Mod/Part/Gui/DlgProjectionOnSurface.cpp b/src/Mod/Part/Gui/DlgProjectionOnSurface.cpp index 7267f49703..78c627df01 100644 --- a/src/Mod/Part/Gui/DlgProjectionOnSurface.cpp +++ b/src/Mod/Part/Gui/DlgProjectionOnSurface.cpp @@ -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("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(); From 9683cf1e4f675f417762cd4ef0f2afd7441cded8 Mon Sep 17 00:00:00 2001 From: Ladislav Michl Date: Thu, 1 May 2025 10:14:18 +0200 Subject: [PATCH 2/2] Base: rename Exception's PascalCase methods to camelCase --- src/App/Application.cpp | 6 +- src/App/AutoTransaction.cpp | 6 +- src/App/ComplexGeoData.cpp | 2 +- src/App/Datums.cpp | 2 +- src/App/Document.cpp | 18 ++-- src/App/DocumentObject.cpp | 2 +- src/App/DocumentObserverPython.cpp | 58 ++++++------- src/App/DocumentPyImp.cpp | 2 +- src/App/Expression.cpp | 2 +- src/App/ExtensionPython.h | 2 +- src/App/FeaturePython.cpp | 38 ++++---- src/App/GroupExtension.cpp | 2 +- src/App/Link.cpp | 8 +- src/App/MeasureManager.cpp | 4 +- src/App/ObjectIdentifier.cpp | 18 ++-- src/App/Property.h | 2 +- src/App/PropertyExpressionEngine.cpp | 2 +- src/App/PropertyLinks.cpp | 4 +- src/App/PropertyPythonObject.cpp | 10 +-- src/App/PropertyStandard.cpp | 2 +- src/App/StringHasher.cpp | 2 +- src/App/Transactions.cpp | 4 +- src/Base/Exception.cpp | 4 +- src/Base/Exception.h | 4 +- src/Base/Interpreter.cpp | 12 +-- src/Base/Interpreter.h | 4 +- src/Base/ParameterPy.cpp | 4 +- src/Gui/Action.cpp | 2 +- src/Gui/Application.cpp | 14 +-- src/Gui/Command.cpp | 8 +- src/Gui/CommandDoc.cpp | 4 +- src/Gui/CommandFeat.cpp | 2 +- src/Gui/CommandLink.cpp | 12 +-- src/Gui/Dialogs/DlgAddProperty.cpp | 4 +- src/Gui/Dialogs/DlgAddPropertyVarSet.cpp | 2 +- src/Gui/Dialogs/DlgMacroExecuteImp.cpp | 2 +- src/Gui/Dialogs/DlgPreferencesImp.cpp | 2 +- src/Gui/Document.cpp | 12 +-- src/Gui/DocumentObserverPython.cpp | 22 ++--- src/Gui/EditorView.cpp | 2 +- src/Gui/MDIViewPyWrap.cpp | 20 ++--- src/Gui/Macro.cpp | 2 +- src/Gui/MainWindow.cpp | 6 +- src/Gui/Navigation/GestureNavigationStyle.cpp | 2 +- src/Gui/OnlineDocumentation.cpp | 2 +- src/Gui/PythonWrapper.cpp | 2 +- src/Gui/Selection/Selection.cpp | 2 +- src/Gui/Selection/SelectionFilter.cpp | 2 +- src/Gui/Selection/SelectionObserverPython.cpp | 14 +-- src/Gui/Selection/SelectionView.cpp | 18 ++-- src/Gui/SoFCColorBar.cpp | 2 +- src/Gui/SoFCColorGradient.cpp | 2 +- src/Gui/TaskElementColors.cpp | 2 +- src/Gui/TaskView/TaskDialogPython.cpp | 30 +++---- src/Gui/Tree.cpp | 12 +-- src/Gui/ViewProviderFeaturePython.cpp | 86 +++++++++---------- src/Gui/ViewProviderLink.cpp | 20 ++--- src/Gui/WidgetFactory.cpp | 4 +- src/Gui/WorkbenchManipulatorPython.cpp | 8 +- src/Gui/propertyeditor/PropertyEditor.cpp | 4 +- src/Gui/propertyeditor/PropertyItem.cpp | 6 +- src/Main/MainCmd.cpp | 2 +- src/Main/MainGui.cpp | 2 +- src/Mod/CAM/App/AppPathPy.cpp | 2 +- src/Mod/Drawing/App/AppDrawingPy.cpp | 2 +- src/Mod/Fem/Gui/TaskPostBoxes.cpp | 4 +- src/Mod/Fem/Gui/ViewProviderFemPostObject.cpp | 2 +- src/Mod/Import/App/ImportOCAF.cpp | 2 +- src/Mod/Import/App/dxf/dxf.cpp | 2 +- src/Mod/Measure/App/AppMeasurePy.cpp | 2 +- src/Mod/Measure/App/MeasureBase.cpp | 8 +- src/Mod/Measure/Gui/QuickMeasure.cpp | 2 +- src/Mod/Mesh/Gui/AppMeshGui.cpp | 2 +- src/Mod/MeshPart/App/AppMeshPartPy.cpp | 2 +- src/Mod/Part/App/AppPartPy.cpp | 4 +- src/Mod/Part/App/Geometry.cpp | 16 ++-- src/Mod/Part/App/PartFeature.cpp | 2 +- src/Mod/Part/Gui/AppPartGui.cpp | 2 +- src/Mod/Part/Gui/CommandSimple.cpp | 2 +- src/Mod/Part/Gui/DlgBooleanOperation.cpp | 2 +- src/Mod/Part/Gui/DlgExtrusion.cpp | 4 +- src/Mod/Part/Gui/SectionCutting.cpp | 10 +-- src/Mod/Part/Gui/ShapeFromMesh.cpp | 2 +- src/Mod/Part/Gui/TaskAttacher.cpp | 6 +- src/Mod/Part/Gui/TaskCheckGeometry.cpp | 4 +- src/Mod/PartDesign/App/Feature.cpp | 2 +- src/Mod/PartDesign/App/FeatureHole.cpp | 2 +- src/Mod/PartDesign/App/ShapeBinder.cpp | 8 +- src/Mod/PartDesign/Gui/Command.cpp | 4 +- .../PartDesign/Gui/TaskChamferParameters.cpp | 2 +- .../PartDesign/Gui/TaskDraftParameters.cpp | 2 +- .../PartDesign/Gui/TaskDressUpParameters.cpp | 4 +- .../PartDesign/Gui/TaskExtrudeParameters.cpp | 2 +- src/Mod/PartDesign/Gui/TaskFeaturePick.cpp | 2 +- .../PartDesign/Gui/TaskFilletParameters.cpp | 2 +- .../PartDesign/Gui/TaskHelixParameters.cpp | 8 +- .../Gui/TaskMultiTransformParameters.cpp | 2 +- src/Mod/PartDesign/Gui/TaskPipeParameters.cpp | 4 +- .../Gui/TaskRevolutionParameters.cpp | 8 +- .../Gui/TaskThicknessParameters.cpp | 2 +- .../Gui/TaskTransformedParameters.cpp | 10 +-- src/Mod/PartDesign/Gui/ViewProviderBody.cpp | 2 +- .../Gui/ViewProviderShapeBinder.cpp | 4 +- src/Mod/Points/Gui/Command.cpp | 2 +- .../Gui/FitBSplineCurve.cpp | 2 +- src/Mod/Sketcher/App/SketchObject.cpp | 8 +- .../Sketcher/Gui/CommandSketcherBSpline.cpp | 8 +- src/Mod/Sketcher/Gui/DrawSketchController.h | 2 +- .../Sketcher/Gui/DrawSketchHandlerCircle.h | 2 +- .../Sketcher/Gui/DrawSketchHandlerRotate.h | 2 +- src/Mod/Sketcher/Gui/DrawSketchHandlerScale.h | 2 +- .../Sketcher/Gui/DrawSketchHandlerSymmetry.h | 2 +- .../Sketcher/Gui/DrawSketchHandlerTranslate.h | 2 +- .../Gui/EditModeConstraintCoinManager.cpp | 2 +- .../Gui/EditModeGeometryCoinConverter.cpp | 2 +- ...ditModeInformationOverlayCoinConverter.cpp | 2 +- src/Mod/Sketcher/Gui/SketcherSettings.cpp | 2 +- src/Mod/Sketcher/Gui/SnapManager.cpp | 2 +- src/Mod/Sketcher/Gui/ViewProviderSketch.cpp | 2 +- src/Mod/Spreadsheet/App/Cell.cpp | 2 +- src/Mod/Spreadsheet/App/Sheet.cpp | 2 +- src/Mod/Spreadsheet/Gui/DlgBindSheet.cpp | 4 +- src/Mod/Spreadsheet/Gui/DlgSheetConf.cpp | 6 +- src/Mod/Spreadsheet/Gui/SheetModel.cpp | 2 +- src/Mod/Spreadsheet/Gui/SheetTableView.cpp | 2 +- src/Mod/TechDraw/App/AppTechDrawPy.cpp | 2 +- src/Mod/TechDraw/Gui/AppTechDrawGuiPy.cpp | 2 +- src/Mod/TechDraw/Gui/DrawGuiUtil.cpp | 6 +- 128 files changed, 394 insertions(+), 394 deletions(-) diff --git a/src/App/Application.cpp b/src/App/Application.cpp index 50185a3bbc..68461ae856 100644 --- a/src/App/Application.cpp +++ b/src/App/Application.cpp @@ -793,7 +793,7 @@ std::vector Application::openDocuments(const std::vector _objCount = -1; } catch (const Base::Exception &e) { - e.ReportException(); + e.reportException(); if (!errs && isMainDoc) throw; if (errs && isMainDoc) @@ -857,7 +857,7 @@ std::vector Application::openDocuments(const std::vector 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 diff --git a/src/App/AutoTransaction.cpp b/src/App/AutoTransaction.cpp index b70a4d5797..ccb42c111e 100644 --- a/src/App/AutoTransaction.cpp +++ b/src/App/AutoTransaction.cpp @@ -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()); diff --git a/src/App/ComplexGeoData.cpp b/src/App/ComplexGeoData.cpp index 02c02d1bb6..80e7e2f741 100644 --- a/src/App/ComplexGeoData.cpp +++ b/src/App/ComplexGeoData.cpp @@ -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(); } diff --git a/src/App/Datums.cpp b/src/App/Datums.cpp index f4cce14b0f..cb8bbeb865 100644 --- a/src/App/Datums.cpp +++ b/src/App/Datums.cpp @@ -388,7 +388,7 @@ bool LocalCoordinateSystem::extensionGetSubObject(DocumentObject*& ret, return true; } catch (const Base::Exception& e) { - e.ReportException(); + e.reportException(); return false; } } diff --git a/src/App/Document.cpp b/src/App/Document.cpp index e2e5ff7026..a32e88180f 100644 --- a/src/App/Document.cpp +++ b/src/App/Document.cpp @@ -1557,19 +1557,19 @@ std::vector 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& objs, } } catch (Base::Exception& e) { - e.ReportException(); + e.reportException(); } FC_TIME_LOG(t2, "Recompute"); @@ -3117,7 +3117,7 @@ int Document::recompute(const std::vector& 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; diff --git a/src/App/DocumentObject.cpp b/src/App/DocumentObject.cpp index d8d1c439af..700b9642af 100644 --- a/src/App/DocumentObject.cpp +++ b/src/App/DocumentObject.cpp @@ -148,7 +148,7 @@ void DocumentObject::printInvalidLinks() const scopenames.c_str()); } catch (const Base::Exception& e) { - e.ReportException(); + e.reportException(); } } diff --git a/src/App/DocumentObserverPython.cpp b/src/App/DocumentObserverPython.cpp index f36515dd8a..22a61ecdb1 100644 --- a/src/App/DocumentObserverPython.cpp +++ b/src/App/DocumentObserverPython.cpp @@ -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(); } } diff --git a/src/App/DocumentPyImp.cpp b/src/App/DocumentPyImp.cpp index 37c9829f8b..22df71f1f5 100644 --- a/src/App/DocumentPyImp.cpp +++ b/src/App/DocumentPyImp.cpp @@ -381,7 +381,7 @@ PyObject* DocumentPy::addObject(PyObject* args, PyObject* kwd) } catch (Py::Exception&) { Base::PyException e; - e.ReportException(); + e.reportException(); } } diff --git a/src/App/Expression.cpp b/src/App/Expression.cpp index 273b8ae85d..6e9db2bc83 100644 --- a/src/App/Expression.cpp +++ b/src/App/Expression.cpp @@ -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; } diff --git a/src/App/ExtensionPython.h b/src/App/ExtensionPython.h index 6ba59bd548..a4d8e7428b 100644 --- a/src/App/ExtensionPython.h +++ b/src/App/ExtensionPython.h @@ -87,7 +87,7 @@ using ExtensionPython = ExtensionPythonT; catch (Py::Exception&) \ { \ Base::PyException e; \ - e.ReportException(); \ + e.reportException(); \ } #define EXTENSION_PROXY_NOARG(function) \ diff --git a/src/App/FeaturePython.cpp b/src/App/FeaturePython.cpp index c4188223c9..433289fc08 100644 --- a/src/App/FeaturePython.cpp +++ b/src/App/FeaturePython.cpp @@ -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& 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; } diff --git a/src/App/GroupExtension.cpp b/src/App/GroupExtension.cpp index 3eccb53232..35b89da49b 100644 --- a/src/App/GroupExtension.cpp +++ b/src/App/GroupExtension.cpp @@ -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; } } diff --git a/src/App/Link.cpp b/src/App/Link.cpp index b605cf08df..4d515298be 100644 --- a/src/App/Link.cpp +++ b/src/App/Link.cpp @@ -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()); diff --git a/src/App/MeasureManager.cpp b/src/App/MeasureManager.cpp index d6b4c07a81..1047aad850 100644 --- a/src/App/MeasureManager.cpp +++ b/src/App/MeasureManager.cpp @@ -186,7 +186,7 @@ std::vector MeasureManager::getValidMeasureTypes(App::MeasureSelec } catch (const Py::Exception&) { Base::PyException e; - e.ReportException(); + e.reportException(); isValid = Py::False(); } @@ -199,7 +199,7 @@ std::vector MeasureManager::getValidMeasureTypes(App::MeasureSelec } catch (const Py::Exception&) { Base::PyException e; - e.ReportException(); + e.reportException(); isPriority = Py::False(); } diff --git a/src/App/ObjectIdentifier.cpp b/src/App/ObjectIdentifier.cpp index 8dc4797ed4..b4a60b714d 100644 --- a/src/App/ObjectIdentifier.cpp +++ b/src/App/ObjectIdentifier.cpp @@ -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(); } } diff --git a/src/App/Property.h b/src/App/Property.h index edcc977b77..eaaff9cd9f 100644 --- a/src/App/Property.h +++ b/src/App/Property.h @@ -460,7 +460,7 @@ public: mProp.hasSetValue(); } catch (Base::Exception& e) { - e.ReportException(); + e.reportException(); } catch (...) { } diff --git a/src/App/PropertyExpressionEngine.cpp b/src/App/PropertyExpressionEngine.cpp index 31038c4494..dfbab08ea0 100644 --- a/src/App/PropertyExpressionEngine.cpp +++ b/src/App/PropertyExpressionEngine.cpp @@ -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); } diff --git a/src/App/PropertyLinks.cpp b/src/App/PropertyLinks.cpp index 35b4ea3e29..dd501271cb 100644 --- a/src/App/PropertyLinks.cpp +++ b/src/App/PropertyLinks.cpp @@ -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) { diff --git a/src/App/PropertyPythonObject.cpp b/src/App/PropertyPythonObject.cpp index 935abd69fd..8b33b253da 100644 --- a/src/App/PropertyPythonObject.cpp +++ b/src/App/PropertyPythonObject.cpp @@ -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; } diff --git a/src/App/PropertyStandard.cpp b/src/App/PropertyStandard.cpp index 32a0f2e7d4..385277d621 100644 --- a/src/App/PropertyStandard.cpp +++ b/src/App/PropertyStandard.cpp @@ -518,7 +518,7 @@ void PropertyEnumeration::setPyObject(PyObject* value) } catch (Py::Exception&) { Base::PyException e; - e.ReportException(); + e.reportException(); } } diff --git a/src/App/StringHasher.cpp b/src/App/StringHasher.cpp index 3e2a211841..dbe6c064cb 100644 --- a/src/App/StringHasher.cpp +++ b/src/App/StringHasher.cpp @@ -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"); diff --git a/src/App/Transactions.cpp b/src/App/Transactions.cpp index 89905d6f63..af83c79d9b 100644 --- a/src/App/Transactions.cpp +++ b/src/App/Transactions.cpp @@ -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) { diff --git a/src/Base/Exception.cpp b/src/Base/Exception.cpp index 45bbe65155..aba6e95ee6 100644 --- a/src/Base/Exception.cpp +++ b/src/Base/Exception.cpp @@ -70,7 +70,7 @@ const char* Exception::what() const noexcept return errorMessage.c_str(); } -void Exception::ReportException() const +void Exception::reportException() const { if (hasBeenReported) { return; @@ -247,7 +247,7 @@ const char* FileException::what() const noexcept return _sErrMsgAndFileName.c_str(); } -void FileException::ReportException() const +void FileException::reportException() const { if (getReported()) { return; diff --git a/src/Base/Exception.h b/src/Base/Exception.h index 047ea54cb9..b85a3592c1 100644 --- a/src/Base/Exception.h +++ b/src/Base/Exception.h @@ -157,7 +157,7 @@ public: Exception& operator=(Exception&& inst) noexcept; virtual const char* what() const noexcept; - virtual void ReportException() const; // once only + virtual void reportException() const; // once only inline void setMessage(const std::string& message); // what may differ from the message given by the user in @@ -242,7 +242,7 @@ public: FileException(const std::string& message, const FileInfo& File); const char* what() const noexcept override; - void ReportException() const override; + void reportException() const override; std::string getFileName() const; PyObject* getPyObject() override; diff --git a/src/Base/Interpreter.cpp b/src/Base/Interpreter.cpp index 7cc9765b7d..8538d395f4 100644 --- a/src/Base/Interpreter.cpp +++ b/src/Base/Interpreter.cpp @@ -89,10 +89,10 @@ PyException::PyException() PyException::~PyException() noexcept = default; -void PyException::ThrowException() +void PyException::throwException() { PyException myexcp; - myexcp.ReportException(); + myexcp.reportException(); myexcp.raiseException(); } @@ -123,7 +123,7 @@ void PyException::raiseException() throw *this; } -void PyException::ReportException() const +void PyException::reportException() const { if (!getReported()) { setReported(true); @@ -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); @@ -657,7 +657,7 @@ std::string InterpreterSingleton::init(int argc, char* argv[]) return getPythonPath(); } catch (const Exception& e) { - e.ReportException(); + e.reportException(); throw; } } diff --git a/src/Base/Interpreter.h b/src/Base/Interpreter.h index e2196a3897..4ab7d0f993 100644 --- a/src/Base/Interpreter.h +++ b/src/Base/Interpreter.h @@ -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; diff --git a/src/Base/ParameterPy.cpp b/src/Base/ParameterPy.cpp index 07483ef92e..2f000d80bd 100644 --- a/src/Base/ParameterPy.cpp +++ b/src/Base/ParameterPy.cpp @@ -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(); } } diff --git a/src/Gui/Action.cpp b/src/Gui/Action.cpp index 2c940ca0a7..c9b9705cb8 100644 --- a/src/Gui/Action.cpp +++ b/src/Gui/Action.cpp @@ -1143,7 +1143,7 @@ void RecentMacrosAction::activateFile(int id) // handle SystemExit exceptions Base::PyGILStateLocker locker; Base::PyException exc; - exc.ReportException(); + exc.reportException(); } } } diff --git a/src/Gui/Application.cpp b/src/Gui/Application.cpp index 355b78163a..7e0367fda8 100644 --- a/src/Gui/Application.cpp +++ b/src/Gui/Application.cpp @@ -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"; -} \ No newline at end of file +} diff --git a/src/Gui/Command.cpp b/src/Gui/Command.cpp index 301386060a..550b5fa2f3 100644 --- a/src/Gui/Command.cpp +++ b/src/Gui/Command.cpp @@ -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(); } } diff --git a/src/Gui/CommandDoc.cpp b/src/Gui/CommandDoc.cpp index bec6a42af0..a4e810e020 100644 --- a/src/Gui/CommandDoc.cpp +++ b/src/Gui/CommandDoc.cpp @@ -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(); } } diff --git a/src/Gui/CommandFeat.cpp b/src/Gui/CommandFeat.cpp index 3252ba52c6..a16c801daf 100644 --- a/src/Gui/CommandFeat.cpp +++ b/src/Gui/CommandFeat.cpp @@ -293,7 +293,7 @@ void StdCmdSendToPythonConsole::activated(int iMsg) } } catch (const Base::Exception& e) { - e.ReportException(); + e.reportException(); } } diff --git a/src/Gui/CommandLink.cpp b/src/Gui/CommandLink.cpp index 42f9252887..4eea6d8b81 100644 --- a/src/Gui/CommandLink.cpp +++ b/src/Gui/CommandLink.cpp @@ -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(); } } diff --git a/src/Gui/Dialogs/DlgAddProperty.cpp b/src/Gui/Dialogs/DlgAddProperty.cpp index af04c125e3..330949e3cc 100644 --- a/src/Gui/Dialogs/DlgAddProperty.cpp +++ b/src/Gui/Dialogs/DlgAddProperty.cpp @@ -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(), diff --git a/src/Gui/Dialogs/DlgAddPropertyVarSet.cpp b/src/Gui/Dialogs/DlgAddPropertyVarSet.cpp index 525dd99804..94011897c6 100644 --- a/src/Gui/Dialogs/DlgAddPropertyVarSet.cpp +++ b/src/Gui/Dialogs/DlgAddPropertyVarSet.cpp @@ -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()), diff --git a/src/Gui/Dialogs/DlgMacroExecuteImp.cpp b/src/Gui/Dialogs/DlgMacroExecuteImp.cpp index 24f793d5b8..16647db174 100644 --- a/src/Gui/Dialogs/DlgMacroExecuteImp.cpp +++ b/src/Gui/Dialogs/DlgMacroExecuteImp.cpp @@ -396,7 +396,7 @@ void DlgMacroExecuteImp::accept() // handle SystemExit exceptions Base::PyGILStateLocker locker; Base::PyException e; - e.ReportException(); + e.reportException(); getMainWindow()->unsetCursor(); } } diff --git a/src/Gui/Dialogs/DlgPreferencesImp.cpp b/src/Gui/Dialogs/DlgPreferencesImp.cpp index 45b6656b94..9929302b5c 100644 --- a/src/Gui/Dialogs/DlgPreferencesImp.cpp +++ b/src/Gui/Dialogs/DlgPreferencesImp.cpp @@ -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()); diff --git a/src/Gui/Document.cpp b/src/Gui/Document.cpp index 546093c4e8..b31b1f520c 100644 --- a/src/Gui/Document.cpp +++ b/src/Gui/Document.cpp @@ -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(&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); diff --git a/src/Gui/DocumentObserverPython.cpp b/src/Gui/DocumentObserverPython.cpp index c50e547bb4..ef05c42638 100644 --- a/src/Gui/DocumentObserverPython.cpp +++ b/src/Gui/DocumentObserverPython.cpp @@ -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(); } } diff --git a/src/Gui/EditorView.cpp b/src/Gui/EditorView.cpp index c62f278309..69fda4a503 100644 --- a/src/Gui/EditorView.cpp +++ b/src/Gui/EditorView.cpp @@ -718,7 +718,7 @@ void PythonEditorView::executeScript() // handle SystemExit exceptions Base::PyGILStateLocker locker; Base::PyException e; - e.ReportException(); + e.reportException(); getMainWindow()->unsetCursor(); } } diff --git a/src/Gui/MDIViewPyWrap.cpp b/src/Gui/MDIViewPyWrap.cpp index 77376f9f83..f6ab727155 100644 --- a/src/Gui/MDIViewPyWrap.cpp +++ b/src/Gui/MDIViewPyWrap.cpp @@ -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(); } } diff --git a/src/Gui/Macro.cpp b/src/Gui/Macro.cpp index e7f20e1ee7..fdb9199130 100644 --- a/src/Gui/Macro.cpp +++ b/src/Gui/Macro.cpp @@ -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()); diff --git a/src/Gui/MainWindow.cpp b/src/Gui/MainWindow.cpp index 744d7d0a7b..0ac0f4b9da 100644 --- a/src/Gui/MainWindow.cpp +++ b/src/Gui/MainWindow.cpp @@ -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; diff --git a/src/Gui/Navigation/GestureNavigationStyle.cpp b/src/Gui/Navigation/GestureNavigationStyle.cpp index a7ee06b82c..b31f0c73fb 100644 --- a/src/Gui/Navigation/GestureNavigationStyle.cpp +++ b/src/Gui/Navigation/GestureNavigationStyle.cpp @@ -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()); } diff --git a/src/Gui/OnlineDocumentation.cpp b/src/Gui/OnlineDocumentation.cpp index e35486ebf3..2bbbbf9e81 100644 --- a/src/Gui/OnlineDocumentation.cpp +++ b/src/Gui/OnlineDocumentation.cpp @@ -124,7 +124,7 @@ QByteArray PythonOnlineHelp::invoke(const std::functioncustomize(this); } catch (const Base::ValueError& e) { - e.ReportException(); + e.reportException(); } } diff --git a/src/Gui/SoFCColorGradient.cpp b/src/Gui/SoFCColorGradient.cpp index 50c7a15190..9f7af9e366 100644 --- a/src/Gui/SoFCColorGradient.cpp +++ b/src/Gui/SoFCColorGradient.cpp @@ -440,7 +440,7 @@ void SoFCColorGradient::customize(SoFCColorBarBase* parentNode) applyProfile(dlg.getProfile(), dlg.numberOfDecimals()); } catch (const Base::Exception& e) { - e.ReportException(); + e.reportException(); } }); diff --git a/src/Gui/TaskElementColors.cpp b/src/Gui/TaskElementColors.cpp index 0741bc25af..c11eb8d99b 100644 --- a/src/Gui/TaskElementColors.cpp +++ b/src/Gui/TaskElementColors.cpp @@ -108,7 +108,7 @@ public: vpParent->OnTopWhenSelected.setValue(onTopMode); } catch (const Base::Exception& e) { - e.ReportException(); + e.reportException(); } } diff --git a/src/Gui/TaskView/TaskDialogPython.cpp b/src/Gui/TaskView/TaskDialogPython.cpp index 7650778226..2c721742df 100644 --- a/src/Gui/TaskView/TaskDialogPython.cpp +++ b/src/Gui/TaskView/TaskDialogPython.cpp @@ -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(); } } diff --git a/src/Gui/Tree.cpp b/src/Gui/Tree.cpp index 88b82d6345..4c81c216be 100644 --- a/src/Gui/Tree.cpp +++ b/src/Gui/Tree.cpp @@ -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()); diff --git a/src/Gui/ViewProviderFeaturePython.cpp b/src/Gui/ViewProviderFeaturePython.cpp index 23c4c1383c..f92045caef 100644 --- a/src/Gui/ViewProviderFeaturePython.cpp +++ b/src/Gui/ViewProviderFeaturePython.cpp @@ -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::vectortruncate(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 & 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 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; } diff --git a/src/Gui/ViewProviderLink.cpp b/src/Gui/ViewProviderLink.cpp index b9c0f126f9..265d77ef56 100644 --- a/src/Gui/ViewProviderLink.cpp +++ b/src/Gui/ViewProviderLink.cpp @@ -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(); } } diff --git a/src/Gui/WidgetFactory.cpp b/src/Gui/WidgetFactory.cpp index 01f820e09a..994cba7264 100644 --- a/src/Gui/WidgetFactory.cpp +++ b/src/Gui/WidgetFactory.cpp @@ -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(); } } diff --git a/src/Gui/WorkbenchManipulatorPython.cpp b/src/Gui/WorkbenchManipulatorPython.cpp index e7c220da41..dafcdf0361 100644 --- a/src/Gui/WorkbenchManipulatorPython.cpp +++ b/src/Gui/WorkbenchManipulatorPython.cpp @@ -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(); } } diff --git a/src/Gui/propertyeditor/PropertyEditor.cpp b/src/Gui/propertyeditor/PropertyEditor.cpp index 653064ed15..b47481a257 100644 --- a/src/Gui/propertyeditor/PropertyEditor.cpp +++ b/src/Gui/propertyeditor/PropertyEditor.cpp @@ -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; diff --git a/src/Gui/propertyeditor/PropertyItem.cpp b/src/Gui/propertyeditor/PropertyItem.cpp index d5bedcf79e..17760c11f3 100644 --- a/src/Gui/propertyeditor/PropertyItem.cpp +++ b/src/Gui/propertyeditor/PropertyItem.cpp @@ -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(); } } diff --git a/src/Main/MainCmd.cpp b/src/Main/MainCmd.cpp index 54430ff2c8..94fe05664e 100644 --- a/src/Main/MainCmd.cpp +++ b/src/Main/MainCmd.cpp @@ -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 (...) { diff --git a/src/Main/MainGui.cpp b/src/Main/MainGui.cpp index 645e6df06e..2e2f1b371e 100644 --- a/src/Main/MainGui.cpp +++ b/src/Main/MainGui.cpp @@ -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) { diff --git a/src/Mod/CAM/App/AppPathPy.cpp b/src/Mod/CAM/App/AppPathPy.cpp index 5239ca7632..a1a58e3e99 100644 --- a/src/Mod/CAM/App/AppPathPy.cpp +++ b/src/Mod/CAM/App/AppPathPy.cpp @@ -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) \ diff --git a/src/Mod/Drawing/App/AppDrawingPy.cpp b/src/Mod/Drawing/App/AppDrawingPy.cpp index 274ffbd249..585b977595 100644 --- a/src/Mod/Drawing/App/AppDrawingPy.cpp +++ b/src/Mod/Drawing/App/AppDrawingPy.cpp @@ -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) { diff --git a/src/Mod/Fem/Gui/TaskPostBoxes.cpp b/src/Mod/Fem/Gui/TaskPostBoxes.cpp index fefe174507..6d64b89cea 100644 --- a/src/Mod/Fem/Gui/TaskPostBoxes.cpp +++ b/src/Mod/Fem/Gui/TaskPostBoxes.cpp @@ -877,7 +877,7 @@ void TaskPostDataAlongLine::point1Changed(double) getObject()->GetAxisData(); } catch (const Base::Exception& e) { - e.ReportException(); + e.reportException(); } } @@ -1194,7 +1194,7 @@ void TaskPostDataAtPoint::centerChanged(double) onFieldActivated(currentField); } catch (const Base::Exception& e) { - e.ReportException(); + e.reportException(); } } diff --git a/src/Mod/Fem/Gui/ViewProviderFemPostObject.cpp b/src/Mod/Fem/Gui/ViewProviderFemPostObject.cpp index 0eaeb5047b..49b6653c2b 100644 --- a/src/Mod/Fem/Gui/ViewProviderFemPostObject.cpp +++ b/src/Mod/Fem/Gui/ViewProviderFemPostObject.cpp @@ -673,7 +673,7 @@ void ViewProviderFemPostObject::setRangeOfColorBar(float min, float max) m_colorBar->setRange(min, max); } catch (const Base::ValueError& e) { - e.ReportException(); + e.reportException(); } } diff --git a/src/Mod/Import/App/ImportOCAF.cpp b/src/Mod/Import/App/ImportOCAF.cpp index 89d40ec7d7..945d102aa7 100644 --- a/src/Mod/Import/App/ImportOCAF.cpp +++ b/src/Mod/Import/App/ImportOCAF.cpp @@ -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(); } } diff --git a/src/Mod/Import/App/dxf/dxf.cpp b/src/Mod/Import/App/dxf/dxf.cpp index 6168d77964..5ade18c181 100644 --- a/src/Mod/Import/App/dxf/dxf.cpp +++ b/src/Mod/Import/App/dxf/dxf.cpp @@ -2912,7 +2912,7 @@ bool CDxfRead::ReadEntitiesSection() } } catch (const Base::Exception& e) { - e.ReportException(); + e.reportException(); } catch (...) { ImportError("CDxfRead::ReadEntity raised unknown exception\n"); diff --git a/src/Mod/Measure/App/AppMeasurePy.cpp b/src/Mod/Measure/App/AppMeasurePy.cpp index 292b5196dd..c900f993da 100644 --- a/src/Mod/Measure/App/AppMeasurePy.cpp +++ b/src/Mod/Measure/App/AppMeasurePy.cpp @@ -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) { diff --git a/src/Mod/Measure/App/MeasureBase.cpp b/src/Mod/Measure/App/MeasureBase.cpp index 3b6660ba62..10bfb64f55 100644 --- a/src/Mod/Measure/App/MeasureBase.cpp +++ b/src/Mod/Measure/App/MeasureBase.cpp @@ -81,7 +81,7 @@ std::vector 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 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()); diff --git a/src/Mod/Measure/Gui/QuickMeasure.cpp b/src/Mod/Measure/Gui/QuickMeasure.cpp index 21a918de14..6ad953db88 100644 --- a/src/Mod/Measure/Gui/QuickMeasure.cpp +++ b/src/Mod/Measure/Gui/QuickMeasure.cpp @@ -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); diff --git a/src/Mod/Mesh/Gui/AppMeshGui.cpp b/src/Mod/Mesh/Gui/AppMeshGui.cpp index efdc2467a8..d19bfb68bb 100644 --- a/src/Mod/Mesh/Gui/AppMeshGui.cpp +++ b/src/Mod/Mesh/Gui/AppMeshGui.cpp @@ -149,7 +149,7 @@ PyMOD_INIT_FUNC(MeshGui) Base::Interpreter().runString("import MeshFlatteningCommand"); } catch (Base::PyException& err) { - err.ReportException(); + err.reportException(); } // register preferences pages diff --git a/src/Mod/MeshPart/App/AppMeshPartPy.cpp b/src/Mod/MeshPart/App/AppMeshPartPy.cpp index 5b62b4216e..76368c349c 100644 --- a/src/Mod/MeshPart/App/AppMeshPartPy.cpp +++ b/src/Mod/MeshPart/App/AppMeshPartPy.cpp @@ -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) { diff --git a/src/Mod/Part/App/AppPartPy.cpp b/src/Mod/Part/App/AppPartPy.cpp index b6734ca17b..227441cfe0 100644 --- a/src/Mod/Part/App/AppPartPy.cpp +++ b/src/Mod/Part/App/AppPartPy.cpp @@ -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) { diff --git a/src/Mod/Part/App/Geometry.cpp b/src/Mod/Part/App/Geometry.cpp index e88424e7f8..e8c0a2e4c5 100644 --- a/src/Mod/Part/App/Geometry.cpp +++ b/src/Mod/Part/App/Geometry.cpp @@ -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.") } diff --git a/src/Mod/Part/App/PartFeature.cpp b/src/Mod/Part/App/PartFeature.cpp index 82fa1e94fc..35150b3d02 100644 --- a/src/Mod/Part/App/PartFeature.cpp +++ b/src/Mod/Part/App/PartFeature.cpp @@ -877,7 +877,7 @@ void Feature::setMaterialAppearance(const App::Material& material) ShapeMaterial.setValue(material); } catch (const Base::Exception& e) { - e.ReportException(); + e.reportException(); } } diff --git a/src/Mod/Part/Gui/AppPartGui.cpp b/src/Mod/Part/Gui/AppPartGui.cpp index dbf14a999a..168a553e71 100644 --- a/src/Mod/Part/Gui/AppPartGui.cpp +++ b/src/Mod/Part/Gui/AppPartGui.cpp @@ -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 diff --git a/src/Mod/Part/Gui/CommandSimple.cpp b/src/Mod/Part/Gui/CommandSimple.cpp index 21d4f1f58a..b4bd40c04f 100644 --- a/src/Mod/Part/Gui/CommandSimple.cpp +++ b/src/Mod/Part/Gui/CommandSimple.cpp @@ -196,7 +196,7 @@ void CmdPartPointsFromMesh::activated(int iMsg) } catch (Py::Exception&) { Base::PyException e; - e.ReportException(); + e.reportException(); } commitCommand(); diff --git a/src/Mod/Part/Gui/DlgBooleanOperation.cpp b/src/Mod/Part/Gui/DlgBooleanOperation.cpp index 7482638045..95b9b7f000 100644 --- a/src/Mod/Part/Gui/DlgBooleanOperation.cpp +++ b/src/Mod/Part/Gui/DlgBooleanOperation.cpp @@ -461,7 +461,7 @@ void DlgBooleanOperation::accept() activeDoc->recompute(); } catch (const Base::Exception& e) { - e.ReportException(); + e.reportException(); } } diff --git a/src/Mod/Part/Gui/DlgExtrusion.cpp b/src/Mod/Part/Gui/DlgExtrusion.cpp index 76cbea4787..c7f0bbb621 100644 --- a/src/Mod/Part/Gui/DlgExtrusion.cpp +++ b/src/Mod/Part/Gui/DlgExtrusion.cpp @@ -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(); } } } diff --git a/src/Mod/Part/Gui/SectionCutting.cpp b/src/Mod/Part/Gui/SectionCutting.cpp index b5febc76eb..fd5c5c1683 100644 --- a/src/Mod/Part/Gui/SectionCutting.cpp +++ b/src/Mod/Part/Gui/SectionCutting.cpp @@ -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(); } } diff --git a/src/Mod/Part/Gui/ShapeFromMesh.cpp b/src/Mod/Part/Gui/ShapeFromMesh.cpp index db63862799..14af6e82ef 100644 --- a/src/Mod/Part/Gui/ShapeFromMesh.cpp +++ b/src/Mod/Part/Gui/ShapeFromMesh.cpp @@ -97,7 +97,7 @@ void ShapeFromMesh::accept() perform(); } catch (const Base::Exception& e) { - e.ReportException(); + e.reportException(); } QDialog::accept(); diff --git a/src/Mod/Part/Gui/TaskAttacher.cpp b/src/Mod/Part/Gui/TaskAttacher.cpp index 96ee71a95b..a7620f9bba 100644 --- a/src/Mod/Part/Gui/TaskAttacher.cpp +++ b/src/Mod/Part/Gui/TaskAttacher.cpp @@ -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(); } } } diff --git a/src/Mod/Part/Gui/TaskCheckGeometry.cpp b/src/Mod/Part/Gui/TaskCheckGeometry.cpp index bc8fc68b96..006734b8c7 100644 --- a/src/Mod/Part/Gui/TaskCheckGeometry.cpp +++ b/src/Mod/Part/Gui/TaskCheckGeometry.cpp @@ -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); diff --git a/src/Mod/PartDesign/App/Feature.cpp b/src/Mod/PartDesign/App/Feature.cpp index b519137eda..62283ed5bd 100644 --- a/src/Mod/PartDesign/App/Feature.cpp +++ b/src/Mod/PartDesign/App/Feature.cpp @@ -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()); } diff --git a/src/Mod/PartDesign/App/FeatureHole.cpp b/src/Mod/PartDesign/App/FeatureHole.cpp index a68da0fec8..f37030bb77 100644 --- a/src/Mod/PartDesign/App/FeatureHole.cpp +++ b/src/Mod/PartDesign/App/FeatureHole.cpp @@ -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()); diff --git a/src/Mod/PartDesign/App/ShapeBinder.cpp b/src/Mod/PartDesign/App/ShapeBinder.cpp index cdbe83def8..b99ff6e6c6 100644 --- a/src/Mod/PartDesign/App/ShapeBinder.cpp +++ b/src/Mod/PartDesign/App/ShapeBinder.cpp @@ -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(); } } } diff --git a/src/Mod/PartDesign/Gui/Command.cpp b/src/Mod/PartDesign/Gui/Command.cpp index 328bc0a805..7f7426897e 100644 --- a/src/Mod/PartDesign/Gui/Command.cpp +++ b/src/Mod/PartDesign/Gui/Command.cpp @@ -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); diff --git a/src/Mod/PartDesign/Gui/TaskChamferParameters.cpp b/src/Mod/PartDesign/Gui/TaskChamferParameters.cpp index 3055a92e39..cd2ddf8b20 100644 --- a/src/Mod/PartDesign/Gui/TaskChamferParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskChamferParameters.cpp @@ -289,7 +289,7 @@ TaskChamferParameters::~TaskChamferParameters() } catch (const Py::Exception&) { Base::PyException e; // extract the Python error text - e.ReportException(); + e.reportException(); } } diff --git a/src/Mod/PartDesign/Gui/TaskDraftParameters.cpp b/src/Mod/PartDesign/Gui/TaskDraftParameters.cpp index 15ab17d66e..2b87fd73d3 100644 --- a/src/Mod/PartDesign/Gui/TaskDraftParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskDraftParameters.cpp @@ -268,7 +268,7 @@ TaskDraftParameters::~TaskDraftParameters() } catch (const Py::Exception&) { Base::PyException e; // extract the Python error text - e.ReportException(); + e.reportException(); } } diff --git a/src/Mod/PartDesign/Gui/TaskDressUpParameters.cpp b/src/Mod/PartDesign/Gui/TaskDressUpParameters.cpp index 37adea59b8..aeb7fc2d83 100644 --- a/src/Mod/PartDesign/Gui/TaskDressUpParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskDressUpParameters.cpp @@ -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()); diff --git a/src/Mod/PartDesign/Gui/TaskExtrudeParameters.cpp b/src/Mod/PartDesign/Gui/TaskExtrudeParameters.cpp index 1ebc00dce1..41499a3bd2 100644 --- a/src/Mod/PartDesign/Gui/TaskExtrudeParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskExtrudeParameters.cpp @@ -334,7 +334,7 @@ void TaskExtrudeParameters::tryRecomputeFeature() recomputeFeature(); } catch (const Base::Exception& e) { - e.ReportException(); + e.reportException(); } } diff --git a/src/Mod/PartDesign/Gui/TaskFeaturePick.cpp b/src/Mod/PartDesign/Gui/TaskFeaturePick.cpp index e639744216..7e8aaaa452 100644 --- a/src/Mod/PartDesign/Gui/TaskFeaturePick.cpp +++ b/src/Mod/PartDesign/Gui/TaskFeaturePick.cpp @@ -325,7 +325,7 @@ std::vector TaskFeaturePick::buildFeatures() } } catch (const Base::Exception& e) { - e.ReportException(); + e.reportException(); } catch (Py::Exception& e) { // reported by code analyzers diff --git a/src/Mod/PartDesign/Gui/TaskFilletParameters.cpp b/src/Mod/PartDesign/Gui/TaskFilletParameters.cpp index 4be4ae6adc..1fe48e7d35 100644 --- a/src/Mod/PartDesign/Gui/TaskFilletParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskFilletParameters.cpp @@ -172,7 +172,7 @@ TaskFilletParameters::~TaskFilletParameters() } catch (const Py::Exception&) { Base::PyException e; // extract the Python error text - e.ReportException(); + e.reportException(); } } diff --git a/src/Mod/PartDesign/Gui/TaskHelixParameters.cpp b/src/Mod/PartDesign/Gui/TaskHelixParameters.cpp index 2421e6f564..c018cdf360 100644 --- a/src/Mod/PartDesign/Gui/TaskHelixParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskHelixParameters.cpp @@ -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(); } } diff --git a/src/Mod/PartDesign/Gui/TaskMultiTransformParameters.cpp b/src/Mod/PartDesign/Gui/TaskMultiTransformParameters.cpp index 77362510a5..6e79357ed2 100644 --- a/src/Mod/PartDesign/Gui/TaskMultiTransformParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskMultiTransformParameters.cpp @@ -542,7 +542,7 @@ TaskMultiTransformParameters::~TaskMultiTransformParameters() } catch (const Py::Exception&) { Base::PyException exc; // extract the Python error text - exc.ReportException(); + exc.reportException(); } } diff --git a/src/Mod/PartDesign/Gui/TaskPipeParameters.cpp b/src/Mod/PartDesign/Gui/TaskPipeParameters.cpp index d3656020ef..258d58464c 100644 --- a/src/Mod/PartDesign/Gui/TaskPipeParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskPipeParameters.cpp @@ -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(); } } diff --git a/src/Mod/PartDesign/Gui/TaskRevolutionParameters.cpp b/src/Mod/PartDesign/Gui/TaskRevolutionParameters.cpp index 1aaecd72a0..fecba11e4d 100644 --- a/src/Mod/PartDesign/Gui/TaskRevolutionParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskRevolutionParameters.cpp @@ -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(); diff --git a/src/Mod/PartDesign/Gui/TaskThicknessParameters.cpp b/src/Mod/PartDesign/Gui/TaskThicknessParameters.cpp index 081b2998e1..a356021720 100644 --- a/src/Mod/PartDesign/Gui/TaskThicknessParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskThicknessParameters.cpp @@ -241,7 +241,7 @@ TaskThicknessParameters::~TaskThicknessParameters() } catch (const Py::Exception&) { Base::PyException e; // extract the Python error text - e.ReportException(); + e.reportException(); } } diff --git a/src/Mod/PartDesign/Gui/TaskTransformedParameters.cpp b/src/Mod/PartDesign/Gui/TaskTransformedParameters.cpp index 1b833991ae..68b113263b 100644 --- a/src/Mod/PartDesign/Gui/TaskTransformedParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskTransformedParameters.cpp @@ -531,7 +531,7 @@ void TaskTransformedParameters::hideObject() FCMD_OBJ_HIDE(getTopTransformedObject()); } catch (const Base::Exception& e) { - e.ReportException(); + e.reportException(); } } @@ -541,7 +541,7 @@ void TaskTransformedParameters::showObject() FCMD_OBJ_SHOW(getTopTransformedObject()); } catch (const Base::Exception& e) { - e.ReportException(); + e.reportException(); } } @@ -551,7 +551,7 @@ void TaskTransformedParameters::hideBase() FCMD_OBJ_HIDE(getBaseObject()); } catch (const Base::Exception& e) { - e.ReportException(); + e.reportException(); } } @@ -561,7 +561,7 @@ void TaskTransformedParameters::showBase() FCMD_OBJ_SHOW(getBaseObject()); } catch (const Base::Exception& e) { - e.ReportException(); + e.reportException(); } } @@ -574,7 +574,7 @@ void TaskTransformedParameters::exitSelectionMode() showObject(); } catch (Base::Exception& exc) { - exc.ReportException(); + exc.reportException(); } } diff --git a/src/Mod/PartDesign/Gui/ViewProviderBody.cpp b/src/Mod/PartDesign/Gui/ViewProviderBody.cpp index 860af076b4..d275549542 100644 --- a/src/Mod/PartDesign/Gui/ViewProviderBody.cpp +++ b/src/Mod/PartDesign/Gui/ViewProviderBody.cpp @@ -403,7 +403,7 @@ void ViewProviderBody::dropObject(App::DocumentObject* obj) body->addObjects(move); } catch (const Base::Exception& e) { - e.ReportException(); + e.reportException(); } } else if (!body->BaseFeature.getValue()) { diff --git a/src/Mod/PartDesign/Gui/ViewProviderShapeBinder.cpp b/src/Mod/PartDesign/Gui/ViewProviderShapeBinder.cpp index 5da2b897ec..58b27f7177 100644 --- a/src/Mod/PartDesign/Gui/ViewProviderShapeBinder.cpp +++ b/src/Mod/PartDesign/Gui/ViewProviderShapeBinder.cpp @@ -384,7 +384,7 @@ void ViewProviderSubShapeBinder::updatePlacement(bool transaction) { self->update(PartDesign::SubShapeBinder::UpdateForced); } catch (Base::Exception& e) { - e.ReportException(); + e.reportException(); } return; } @@ -398,7 +398,7 @@ void ViewProviderSubShapeBinder::updatePlacement(bool transaction) { return; } catch (Base::Exception& e) { - e.ReportException(); + e.reportException(); } catch (Standard_Failure& e) { std::ostringstream str; diff --git a/src/Mod/Points/Gui/Command.cpp b/src/Mod/Points/Gui/Command.cpp index b0f76cb089..3250fb6e35 100644 --- a/src/Mod/Points/Gui/Command.cpp +++ b/src/Mod/Points/Gui/Command.cpp @@ -309,7 +309,7 @@ void CmdPointsConvert::activated(int iMsg) catch (const Py::Exception&) { abortCommand(); Base::PyException e; - e.ReportException(); + e.reportException(); } } diff --git a/src/Mod/ReverseEngineering/Gui/FitBSplineCurve.cpp b/src/Mod/ReverseEngineering/Gui/FitBSplineCurve.cpp index 73f3baec44..153b8ee421 100644 --- a/src/Mod/ReverseEngineering/Gui/FitBSplineCurve.cpp +++ b/src/Mod/ReverseEngineering/Gui/FitBSplineCurve.cpp @@ -149,7 +149,7 @@ void FitBSplineCurveWidget::tryCommand(const QString& cmd) } catch (const Base::Exception& e) { Gui::Command::abortCommand(); - e.ReportException(); + e.reportException(); } } diff --git a/src/Mod/Sketcher/App/SketchObject.cpp b/src/Mod/Sketcher/App/SketchObject.cpp index 70d9a72bd4..0cd3178b80 100644 --- a/src/Mod/Sketcher/App/SketchObject.cpp +++ b/src/Mod/Sketcher/App/SketchObject.cpp @@ -3047,7 +3047,7 @@ bool getIntersectionParameter(const Part::Geometry* geo, curve->closestParameter(point, pointParam); } catch (Base::CADKernelError& e) { - e.ReportException(); + e.reportException(); return false; } @@ -10116,7 +10116,7 @@ void SketchObject::onChanged(const App::Property* prop) delete res; } } catch (Base::Exception &e) { - e.ReportException(); + e.reportException(); FC_ERR("Failed to recompute " << ExpressionEngine.getFullName() << ": " << e.what()); // NOLINT } @@ -10426,7 +10426,7 @@ void SketchObject::restoreFinished() } } } catch (Base::Exception &e) { - e.ReportException(); + e.reportException(); FC_ERR("Error while restoring " << getFullName()); } catch (...) { } @@ -11086,7 +11086,7 @@ void SketchObject::setExpression(const App::ObjectIdentifier& path, } } catch (Base::Exception& e) { - e.ReportException(); + e.reportException(); FC_ERR("Failed to recompute " << ExpressionEngine.getFullName() << ": " << e.what()); } solve(); diff --git a/src/Mod/Sketcher/Gui/CommandSketcherBSpline.cpp b/src/Mod/Sketcher/Gui/CommandSketcherBSpline.cpp index ee3f9b5381..81da9dd727 100644 --- a/src/Mod/Sketcher/Gui/CommandSketcherBSpline.cpp +++ b/src/Mod/Sketcher/Gui/CommandSketcherBSpline.cpp @@ -414,7 +414,7 @@ void CmdSketcherIncreaseKnotMultiplicity::activated(int iMsg) // particularly B-spline GeoID might have changed. } catch (const Base::CADKernelError& e) { - e.ReportException(); + e.reportException(); if (e.getTranslatable()) { Gui::TranslatedUserError(Obj, QObject::tr("CAD Kernel Error"), @@ -423,7 +423,7 @@ void CmdSketcherIncreaseKnotMultiplicity::activated(int iMsg) getSelection().clearSelection(); } catch (const Base::Exception& e) { - e.ReportException(); + e.reportException(); if (e.getTranslatable()) { Gui::TranslatedUserError(Obj, QObject::tr("Input Error"), @@ -789,7 +789,7 @@ public: // particularly B-spline GeoID might have changed. } catch (const Base::CADKernelError& e) { - e.ReportException(); + e.reportException(); if (e.getTranslatable()) { Gui::TranslatedUserError(Obj, QObject::tr("CAD Kernel Error"), @@ -797,7 +797,7 @@ public: } } catch (const Base::Exception& e) { - e.ReportException(); + e.reportException(); if (e.getTranslatable()) { Gui::TranslatedUserError(Obj, QObject::tr("Input Error"), diff --git a/src/Mod/Sketcher/Gui/DrawSketchController.h b/src/Mod/Sketcher/Gui/DrawSketchController.h index 9a098826c3..823883ed5a 100644 --- a/src/Mod/Sketcher/Gui/DrawSketchController.h +++ b/src/Mod/Sketcher/Gui/DrawSketchController.h @@ -358,7 +358,7 @@ public: tryViewValueChanged(onviewparameterindex, value); } catch (const Base::Exception& e) { - e.ReportException(); + e.reportException(); } catch (const std::exception& e) { Base::Console().Error("C++ exception in onViewValueChanged: %s\n", e.what()); diff --git a/src/Mod/Sketcher/Gui/DrawSketchHandlerCircle.h b/src/Mod/Sketcher/Gui/DrawSketchHandlerCircle.h index 5137966a49..e4151f601f 100644 --- a/src/Mod/Sketcher/Gui/DrawSketchHandlerCircle.h +++ b/src/Mod/Sketcher/Gui/DrawSketchHandlerCircle.h @@ -142,7 +142,7 @@ private: AutoConstraint::CURVE); } catch (Base::ValueError& e) { - e.ReportException(); + e.reportException(); } } break; default: diff --git a/src/Mod/Sketcher/Gui/DrawSketchHandlerRotate.h b/src/Mod/Sketcher/Gui/DrawSketchHandlerRotate.h index 03be54ee61..a650dc023f 100644 --- a/src/Mod/Sketcher/Gui/DrawSketchHandlerRotate.h +++ b/src/Mod/Sketcher/Gui/DrawSketchHandlerRotate.h @@ -129,7 +129,7 @@ private: Gui::Command::commitCommand(); } catch (const Base::Exception& e) { - e.ReportException(); + e.reportException(); Gui::NotifyError(sketchgui, QT_TRANSLATE_NOOP("Notifications", "Error"), QT_TRANSLATE_NOOP("Notifications", "Failed to rotate")); diff --git a/src/Mod/Sketcher/Gui/DrawSketchHandlerScale.h b/src/Mod/Sketcher/Gui/DrawSketchHandlerScale.h index de54ae32a8..456c1d85be 100644 --- a/src/Mod/Sketcher/Gui/DrawSketchHandlerScale.h +++ b/src/Mod/Sketcher/Gui/DrawSketchHandlerScale.h @@ -125,7 +125,7 @@ private: Gui::Command::commitCommand(); } catch (const Base::Exception& e) { - e.ReportException(); + e.reportException(); Gui::NotifyError(sketchgui, QT_TRANSLATE_NOOP("Notifications", "Error"), QT_TRANSLATE_NOOP("Notifications", "Failed to scale")); diff --git a/src/Mod/Sketcher/Gui/DrawSketchHandlerSymmetry.h b/src/Mod/Sketcher/Gui/DrawSketchHandlerSymmetry.h index dd20bcfb82..2df43af48f 100644 --- a/src/Mod/Sketcher/Gui/DrawSketchHandlerSymmetry.h +++ b/src/Mod/Sketcher/Gui/DrawSketchHandlerSymmetry.h @@ -145,7 +145,7 @@ private: Gui::Command::commitCommand(); } catch (const Base::Exception& e) { - e.ReportException(); + e.reportException(); Gui::NotifyError(sketchgui, QT_TRANSLATE_NOOP("Notifications", "Error"), QT_TRANSLATE_NOOP("Notifications", "Failed to create symmetry")); diff --git a/src/Mod/Sketcher/Gui/DrawSketchHandlerTranslate.h b/src/Mod/Sketcher/Gui/DrawSketchHandlerTranslate.h index 635a1192ad..dfffdd37f3 100644 --- a/src/Mod/Sketcher/Gui/DrawSketchHandlerTranslate.h +++ b/src/Mod/Sketcher/Gui/DrawSketchHandlerTranslate.h @@ -126,7 +126,7 @@ private: Gui::Command::commitCommand(); } catch (const Base::Exception& e) { - e.ReportException(); + e.reportException(); Gui::NotifyError(sketchgui, QT_TRANSLATE_NOOP("Notifications", "Error"), QT_TRANSLATE_NOOP("Notifications", "Failed to translate")); diff --git a/src/Mod/Sketcher/Gui/EditModeConstraintCoinManager.cpp b/src/Mod/Sketcher/Gui/EditModeConstraintCoinManager.cpp index 5d339de4a7..7b9e5481e1 100644 --- a/src/Mod/Sketcher/Gui/EditModeConstraintCoinManager.cpp +++ b/src/Mod/Sketcher/Gui/EditModeConstraintCoinManager.cpp @@ -1620,7 +1620,7 @@ Restart: Base::Console().DeveloperError("EditModeConstraintCoinManager", "Exception during draw: %s\n", e.what()); - e.ReportException(); + e.reportException(); } catch (...) { Base::Console().DeveloperError("EditModeConstraintCoinManager", diff --git a/src/Mod/Sketcher/Gui/EditModeGeometryCoinConverter.cpp b/src/Mod/Sketcher/Gui/EditModeGeometryCoinConverter.cpp index 2babbd66e0..f04aa0a0f8 100644 --- a/src/Mod/Sketcher/Gui/EditModeGeometryCoinConverter.cpp +++ b/src/Mod/Sketcher/Gui/EditModeGeometryCoinConverter.cpp @@ -431,7 +431,7 @@ void EditModeGeometryCoinConverter::convert(const Sketcher::GeometryFacade* geom // it is "just" a visualisation matter OCC could not calculate the curvature // terminating here would mean that the other shapes would not be drawn. // Solution: Report the issue and set dummy curvature to 0 - e.ReportException(); + e.reportException(); Base::Console().DeveloperError( "EditModeGeometryCoinConverter", "Curvature graph for B-spline with GeoId=%d could not be calculated.\n", diff --git a/src/Mod/Sketcher/Gui/EditModeInformationOverlayCoinConverter.cpp b/src/Mod/Sketcher/Gui/EditModeInformationOverlayCoinConverter.cpp index 309f2b6ef4..04d6b68a32 100644 --- a/src/Mod/Sketcher/Gui/EditModeInformationOverlayCoinConverter.cpp +++ b/src/Mod/Sketcher/Gui/EditModeInformationOverlayCoinConverter.cpp @@ -214,7 +214,7 @@ void EditModeInformationOverlayCoinConverter::calculate(const Part::Geometry* ge // it is "just" a visualisation matter OCC could not calculate the curvature // terminating here would mean that the other shapes would not be drawn. // Solution: Report the issue and set dummy curvature to 0 - e.ReportException(); + e.reportException(); Base::Console().DeveloperError( "EditModeInformationOverlayCoinConverter", "Curvature graph for B-spline with GeoId=%d could not be calculated.\n", diff --git a/src/Mod/Sketcher/Gui/SketcherSettings.cpp b/src/Mod/Sketcher/Gui/SketcherSettings.cpp index 82ef50a389..6f965ec3cf 100644 --- a/src/Mod/Sketcher/Gui/SketcherSettings.cpp +++ b/src/Mod/Sketcher/Gui/SketcherSettings.cpp @@ -492,7 +492,7 @@ void SketcherSettingsDisplay::onBtnTVApplyClicked(bool) } catch (Base::PyException& e) { Base::Console().DeveloperError("SketcherSettings", "error in onBtnTVApplyClicked:\n"); - e.ReportException(); + e.reportException(); errMsg = QString::fromLatin1(e.what()); } catch (...) { diff --git a/src/Mod/Sketcher/Gui/SnapManager.cpp b/src/Mod/Sketcher/Gui/SnapManager.cpp index 574102257d..5e15aafcf5 100644 --- a/src/Mod/Sketcher/Gui/SnapManager.cpp +++ b/src/Mod/Sketcher/Gui/SnapManager.cpp @@ -280,7 +280,7 @@ bool SnapManager::snapToObject(double& x, double& y) pointToOverride = curve->pointAtParameter(pointParam); } catch (Base::CADKernelError& e) { - e.ReportException(); + e.reportException(); return false; } diff --git a/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp b/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp index 2a5f3f8ea1..ef4a28882b 100644 --- a/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp +++ b/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp @@ -3078,7 +3078,7 @@ bool ViewProviderSketch::setEdit(int ModNum) catch (Base::PyException& e) { Base::Console().DeveloperError( "ViewProviderSketch", "setEdit: visibility automation failed with an error: \n"); - e.ReportException(); + e.reportException(); } } catch (Base::PyException&) { diff --git a/src/Mod/Spreadsheet/App/Cell.cpp b/src/Mod/Spreadsheet/App/Cell.cpp index d5f573af89..a877ee3bf4 100644 --- a/src/Mod/Spreadsheet/App/Cell.cpp +++ b/src/Mod/Spreadsheet/App/Cell.cpp @@ -201,7 +201,7 @@ void Cell::setExpression(App::ExpressionPtr&& expr) restore(reader, true); } catch (Base::Exception& e) { - e.ReportException(); + e.reportException(); FC_ERR("Failed to restore style of cell " << owner->sheet()->getFullName() << '.' << address.toString() << ": " << e.what()); diff --git a/src/Mod/Spreadsheet/App/Sheet.cpp b/src/Mod/Spreadsheet/App/Sheet.cpp index 52fb12fd1b..ea39f8575f 100644 --- a/src/Mod/Spreadsheet/App/Sheet.cpp +++ b/src/Mod/Spreadsheet/App/Sheet.cpp @@ -943,7 +943,7 @@ void Sheet::recomputeCell(CellAddress p) cell->setException(e.what()); } else { - e.ReportException(); + e.reportException(); } // Mark as erroneous diff --git a/src/Mod/Spreadsheet/Gui/DlgBindSheet.cpp b/src/Mod/Spreadsheet/Gui/DlgBindSheet.cpp index 797b30b070..2b359cc4dc 100644 --- a/src/Mod/Spreadsheet/Gui/DlgBindSheet.cpp +++ b/src/Mod/Spreadsheet/Gui/DlgBindSheet.cpp @@ -267,7 +267,7 @@ void DlgBindSheet::accept() QDialog::accept(); } catch (Base::Exception& e) { - e.ReportException(); + e.reportException(); QMessageBox::critical(this, tr("Bind Spreadsheet Cells"), tr("Error:\n") + QString::fromUtf8(e.what())); @@ -296,7 +296,7 @@ void DlgBindSheet::onDiscard() reject(); } catch (Base::Exception& e) { - e.ReportException(); + e.reportException(); QMessageBox::critical(this, tr("Unbind cells"), QString::fromUtf8(e.what())); Gui::Command::abortCommand(); } diff --git a/src/Mod/Spreadsheet/Gui/DlgSheetConf.cpp b/src/Mod/Spreadsheet/Gui/DlgSheetConf.cpp index 67b0fa352a..7ba6e51a1f 100644 --- a/src/Mod/Spreadsheet/Gui/DlgSheetConf.cpp +++ b/src/Mod/Spreadsheet/Gui/DlgSheetConf.cpp @@ -112,7 +112,7 @@ App::Property* DlgSheetConf::prepare(CellAddress& from, expr.reset(App::Expression::parse(sheet, exprTxt)); } catch (Base::Exception& e) { - e.ReportException(); + e.reportException(); FC_THROWM(Base::RuntimeError, "Failed to parse expression for property"); } if (expr->hasComponent() || !expr->isDerivedFrom()) { @@ -276,7 +276,7 @@ void DlgSheetConf::accept() QDialog::accept(); } catch (Base::Exception& e) { - e.ReportException(); + e.reportException(); QMessageBox::critical(this, tr("Setup configuration table"), QString::fromUtf8(e.what())); if (commandActive) { Gui::Command::abortCommand(); @@ -334,7 +334,7 @@ void DlgSheetConf::onDiscard() QDialog::accept(); } catch (Base::Exception& e) { - e.ReportException(); + e.reportException(); QMessageBox::critical(this, tr("Unsetup configuration table"), QString::fromUtf8(e.what())); if (commandActive) { Gui::Command::abortCommand(); diff --git a/src/Mod/Spreadsheet/Gui/SheetModel.cpp b/src/Mod/Spreadsheet/Gui/SheetModel.cpp index fc498d73be..9f097aac73 100644 --- a/src/Mod/Spreadsheet/Gui/SheetModel.cpp +++ b/src/Mod/Spreadsheet/Gui/SheetModel.cpp @@ -563,7 +563,7 @@ void SheetModel::setCellData(QModelIndex index, QString str) Gui::Command::doCommand(Gui::Command::Doc, "App.ActiveDocument.recompute()"); } catch (const Base::Exception& e) { - e.ReportException(); + e.reportException(); Gui::Command::abortCommand(); } } diff --git a/src/Mod/Spreadsheet/Gui/SheetTableView.cpp b/src/Mod/Spreadsheet/Gui/SheetTableView.cpp index e0f26d9be2..4232657279 100644 --- a/src/Mod/Spreadsheet/Gui/SheetTableView.cpp +++ b/src/Mod/Spreadsheet/Gui/SheetTableView.cpp @@ -817,7 +817,7 @@ void SheetTableView::pasteClipboard() GetApplication().getActiveDocument()->recompute(); } catch (Base::Exception& e) { - e.ReportException(); + e.reportException(); QMessageBox::critical(Gui::getMainWindow(), QObject::tr("Copy & Paste failed"), QString::fromLatin1(e.what())); diff --git a/src/Mod/TechDraw/App/AppTechDrawPy.cpp b/src/Mod/TechDraw/App/AppTechDrawPy.cpp index a9d3a2c0b1..fc65670172 100644 --- a/src/Mod/TechDraw/App/AppTechDrawPy.cpp +++ b/src/Mod/TechDraw/App/AppTechDrawPy.cpp @@ -219,7 +219,7 @@ private: str += "FreeCAD exception thrown ("; str += e.what(); str += ")"; - e.ReportException(); + e.reportException(); throw Py::RuntimeError(str); } catch (const std::exception &e) { diff --git a/src/Mod/TechDraw/Gui/AppTechDrawGuiPy.cpp b/src/Mod/TechDraw/Gui/AppTechDrawGuiPy.cpp index ff6e890d86..57fcb501b0 100644 --- a/src/Mod/TechDraw/Gui/AppTechDrawGuiPy.cpp +++ b/src/Mod/TechDraw/Gui/AppTechDrawGuiPy.cpp @@ -100,7 +100,7 @@ private: str += "FreeCAD exception thrown ("; str += e.what(); str += ")"; - e.ReportException(); + e.reportException(); throw Py::RuntimeError(str); } catch (const std::exception &e) { diff --git a/src/Mod/TechDraw/Gui/DrawGuiUtil.cpp b/src/Mod/TechDraw/Gui/DrawGuiUtil.cpp index 2de7bfa48a..88ce40a69e 100644 --- a/src/Mod/TechDraw/Gui/DrawGuiUtil.cpp +++ b/src/Mod/TechDraw/Gui/DrawGuiUtil.cpp @@ -443,7 +443,7 @@ bool DrawGuiUtil::isDraftObject(App::DocumentObject* obj) } catch (Py::Exception&) { Base::PyException e; // extract the Python error text - e.ReportException(); + e.reportException(); result = false; } } @@ -474,7 +474,7 @@ bool DrawGuiUtil::isArchObject(App::DocumentObject* obj) } catch (Py::Exception&) { Base::PyException e; // extract the Python error text - e.ReportException(); + e.reportException(); result = false; } } @@ -505,7 +505,7 @@ bool DrawGuiUtil::isArchSection(App::DocumentObject* obj) } catch (Py::Exception&) { Base::PyException e; // extract the Python error text - e.ReportException(); + e.reportException(); result = false; } }