From 2a103cf08e10ee84e1e8ca9d0ee28aec80d030e4 Mon Sep 17 00:00:00 2001 From: Furgo <148809153+furgo16@users.noreply.github.com> Date: Thu, 27 Nov 2025 09:50:47 +0100 Subject: [PATCH] Gui: Unify Python exception reporting in command handlers Replace custom exception formatting with PyException::reportException() for consistent output that includes previously missing exception types. --- src/Gui/Command.cpp | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/src/Gui/Command.cpp b/src/Gui/Command.cpp index 8871f2718d..d3c8bf4480 100644 --- a/src/Gui/Command.cpp +++ b/src/Gui/Command.cpp @@ -1444,12 +1444,8 @@ void PythonCommand::activated(int iMsg) } } catch (const Base::PyException& e) { - Base::Console().error( - "Running the Python command '%s' failed:\n%s\n%s", - sName, - e.getStackTrace().c_str(), - e.what() - ); + Base::Console().error("Running the Python command '%s' failed:", sName); + e.reportException(); } catch (const Base::Exception&) { Base::Console().error("Running the Python command '%s' failed, try to resume", sName); @@ -1697,12 +1693,8 @@ void PythonGroupCommand::activated(int iMsg) catch (Py::Exception&) { Base::PyGILStateLocker lock; Base::PyException e; - Base::Console().error( - "Running the Python command '%s' failed:\n%s\n%s", - sName, - e.getStackTrace().c_str(), - e.what() - ); + Base::Console().error("Running the Python command '%s' failed:", sName); + e.reportException(); } } @@ -1794,12 +1786,8 @@ Action* PythonGroupCommand::createAction() catch (Py::Exception&) { Base::PyGILStateLocker lock; Base::PyException e; - Base::Console().error( - "createAction() of the Python command '%s' failed:\n%s\n%s", - sName, - e.getStackTrace().c_str(), - e.what() - ); + Base::Console().error("createAction() of the Python command '%s' failed:", sName); + e.reportException(); } _pcAction = pcAction;