Improve error message for mixed arg indexing in format string
This commit is contained in:
parent
de170fa579
commit
254111ff91
|
@ -159,6 +159,7 @@ auto waybar::modules::Custom::update() -> void {
|
||||||
parseOutputRaw();
|
parseOutputRaw();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
auto str = fmt::format(fmt::runtime(format_), fmt::arg("text", text_), fmt::arg("alt", alt_),
|
auto str = fmt::format(fmt::runtime(format_), fmt::arg("text", text_), fmt::arg("alt", alt_),
|
||||||
fmt::arg("icon", getIcon(percentage_, alt_)),
|
fmt::arg("icon", getIcon(percentage_, alt_)),
|
||||||
fmt::arg("percentage", percentage_));
|
fmt::arg("percentage", percentage_));
|
||||||
|
@ -197,6 +198,13 @@ auto waybar::modules::Custom::update() -> void {
|
||||||
style->add_class(MODULE_CLASS);
|
style->add_class(MODULE_CLASS);
|
||||||
event_box_.show();
|
event_box_.show();
|
||||||
}
|
}
|
||||||
|
} catch (const fmt::format_error& e) {
|
||||||
|
if (std::strcmp(e.what(), "cannot switch from manual to automatic argument indexing") != 0)
|
||||||
|
throw;
|
||||||
|
|
||||||
|
throw fmt::format_error("mixing manual and automatic argument indexing is no longer supported; "
|
||||||
|
"try replacing \"{}\" with \"{text}\" in your format specifier");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Call parent update
|
// Call parent update
|
||||||
ALabel::update();
|
ALabel::update();
|
||||||
|
|
Loading…
Reference in New Issue