ISSUE #878. Try catch Clock timezones

Signed-off-by: Viktar Lukashonak <myxabeer@gmail.com>
This commit is contained in:
Viktar Lukashonak 2023-03-02 10:10:34 +03:00
parent 43862ceb34
commit 4cb7e55a91
No known key found for this signature in database
GPG Key ID: 08A413AA87200A6F

View File

@ -22,11 +22,10 @@ waybar::modules::Clock::Clock(const std::string& id, const Json::Value& config)
is_timezoned_list_in_tooltip_(false) { is_timezoned_list_in_tooltip_(false) {
if (config_["timezones"].isArray() && !config_["timezones"].empty()) { if (config_["timezones"].isArray() && !config_["timezones"].empty()) {
for (const auto& zone_name : config_["timezones"]) { for (const auto& zone_name : config_["timezones"]) {
if (!zone_name.isString() || zone_name.asString().empty()) if (!zone_name.isString() || zone_name.asString().empty()) continue;
continue;
try { try {
time_zones_.push_back(date::locate_zone(zone_name.asString())); time_zones_.push_back(date::locate_zone(zone_name.asString()));
} catch(const std::exception& e) { } catch (const std::exception& e) {
spdlog::warn("Timezone: {0}. {1}", zone_name.asString(), e.what()); spdlog::warn("Timezone: {0}. {1}", zone_name.asString(), e.what());
} }
} }