Author Topic: Search for ideas: Report errors in macro replacement to build log pane  (Read 1766 times)

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3021
Hi,
I currently rework the global variables part of codeblocks and i stumbled on a problem in MacrosManager:
The compiler plugin an many other places use this set of functions:
Code
    void ReplaceMacros(wxString& buffer, const ProjectBuildTarget* target = nullptr, bool subrequest = false);
    wxString ReplaceMacros(const wxString& buffer, const ProjectBuildTarget* target = nullptr);
    void ReplaceEnvVars(wxString& buffer) { ReplaceMacros(buffer); }  /* misnomer, should be ReplaceVariables */;
There is no possibility to report any error from this function, or deeper function for example if the global variable is not defined ecc...
Are there any ideas, how we can add error reporting?

One idea from me is, that we add a pointer to a "logger" class.
If the pointer is present log some error messages, if it is nullptr do nothing
A other idea would be to throw an exception
Any other ideas?

Keep in mind, this should work in any place in codeblocks:
* scripting
* plugins (ex. Tools menu)
* build process
* pre, post build steps
* ecc...

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 834
Re: Search for ideas: Report errors in macro replacement to build log pane
« Reply #1 on: October 06, 2021, 02:59:14 pm »
Can't you just use Manager::Get()->GetLogManager()?

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3021
Re: Search for ideas: Report errors in macro replacement to build log pane
« Reply #2 on: October 06, 2021, 03:24:13 pm »
Can't you just use Manager::Get()->GetLogManager()?
It would be nice to report this errors in the build log when it comes from the compiler for example...
If the build fails i do not look in the codeblocks log window for errors, but in the build log