mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-15 12:51:00 +02:00
Add InitError(error, details) overload
This is only used in the current PR to avoid ugly
`strprintf(Untranslated("%s:\n%s"), str, MakeUnorderedList(details)`
boilerplate in init code. But in the future the function could be extended and
more widely used to include more details in GUI error messages or display them
in a more readable way, see code comment.
This commit is contained in:
parent
3db2874bd7
commit
d172b5c671
4 changed files with 16 additions and 3 deletions
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
#include <node/interface_ui.h>
|
||||
|
||||
#include <util/string.h>
|
||||
#include <util/translation.h>
|
||||
|
||||
#include <boost/signals2/optional_last_value.hpp>
|
||||
|
|
@ -62,6 +63,18 @@ bool InitError(const bilingual_str& str)
|
|||
return false;
|
||||
}
|
||||
|
||||
bool InitError(const bilingual_str& str, const std::vector<std::string>& details)
|
||||
{
|
||||
// For now just flatten the list of error details into a string to pass to
|
||||
// the base InitError overload. In the future, if more init code provides
|
||||
// error details, the details could be passed separately from the main
|
||||
// message for rich display in the GUI. But currently the only init
|
||||
// functions which provide error details are ones that run during early init
|
||||
// before the GUI uiInterface is registered, so there's no point passing
|
||||
// main messages and details separately to uiInterface yet.
|
||||
return InitError(details.empty() ? str : strprintf(Untranslated("%s:\n%s"), str, MakeUnorderedList(details)));
|
||||
}
|
||||
|
||||
void InitWarning(const bilingual_str& str)
|
||||
{
|
||||
uiInterface.ThreadSafeMessageBox(str, "", CClientUIInterface::MSG_WARNING);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue