Gui: Command execution output for Developer only

================================================

Problem:
Command execution templates currently are send to Console() error,
which sends messages to both developers and users.

A user sees an error message (for example in the notifications area)
which is just the Python command that FreeCAD executed due to user's
input. This annoys users who do not understand Python and it is not
informative for them.

It is however informative for a developer, who can associate which
command produced which error/exception.

Solution:
To make these messages intended for the Developer only. So that regular
users are not annoyed.

Of course, Developers and power users can always select in preferences,
under Notification Area to be shown debug errors and warnings. In which
case nothing really changes.
This commit is contained in:
Abdullah Tahiri
2023-06-01 09:05:27 +02:00
committed by abdullahtahiriyo
parent 624592fc8b
commit 6cced4defb

View File

@@ -262,10 +262,10 @@ void cmdAppDocumentArgs(const App::Document* doc, const std::string& cmd, Args&&
doc->getName(), _cmd.c_str());
}
catch (const std::exception& e) {
Base::Console().Error("%s: %s\n", e.what(), cmd.c_str());
Base::Console().DeveloperError(doc->Label.getStrValue(),"%s: %s\n", e.what(), cmd.c_str());
}
catch (const Base::Exception&) {
Base::Console().Error("App.getDocument('%s').%s\n",
Base::Console().DeveloperError(doc->Label.getStrValue(),"App.getDocument('%s').%s\n",
doc->getName(), _cmd.c_str());
throw;
}
@@ -385,10 +385,10 @@ void cmdAppObjectArgs(const App::DocumentObject* obj, const std::string& cmd, Ar
obj->getDocument()->getName(), obj->getNameInDocument(), _cmd.c_str());
}
catch (const std::exception& e) {
Base::Console().Error("%s: %s\n", e.what(), cmd.c_str());
Base::Console().DeveloperError(obj->getFullLabel(),"%s: %s\n", e.what(), cmd.c_str());
}
catch (const Base::Exception&) {
Base::Console().Error("App.getDocument('%s').getObject('%s').%s\n",
Base::Console().DeveloperError(obj->getFullLabel(),"App.getDocument('%s').getObject('%s').%s\n",
obj->getDocument()->getName(), obj->getNameInDocument(), _cmd.c_str());
throw;
}
@@ -410,10 +410,10 @@ void cmdGuiObjectArgs(const App::DocumentObject* obj, const std::string& cmd, Ar
obj->getDocument()->getName(), obj->getNameInDocument(), _cmd.c_str());
}
catch (const std::exception& e) {
Base::Console().Error("%s: %s\n", e.what(), cmd.c_str());
Base::Console().DeveloperError(obj->getFullLabel(),"%s: %s\n", e.what(), cmd.c_str());
}
catch (const Base::Exception&) {
Base::Console().Error("Gui.getDocument('%s').getObject('%s').%s\n",
Base::Console().DeveloperError(obj->getFullLabel(),"Gui.getDocument('%s').getObject('%s').%s\n",
obj->getDocument()->getName(), obj->getNameInDocument(), _cmd.c_str());
throw;
}
@@ -443,10 +443,10 @@ void doCommandT(Gui::Command::DoCmd_Type cmdType, const std::string& cmd, Args&&
Gui::Command::doCommand(cmdType,"%s", _cmd.c_str());
}
catch (const std::exception& e) {
Base::Console().Error("%s: %s\n", e.what(), cmd.c_str());
Base::Console().DeveloperError("doCommandT","%s: %s\n", e.what(), cmd.c_str());
}
catch (const Base::Exception&) {
Base::Console().Error("%s\n", _cmd.c_str());
Base::Console().DeveloperError("doCommandT","%s\n", _cmd.c_str());
throw;
}
}