fix: error reporting for deprecated config values (#2725)

This commit is contained in:
Maxim Kolesnikov 2022-06-12 21:31:11 +07:00 committed by GitHub
parent 1ee11f7c9e
commit 0331a5fda4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 6 deletions

View File

@ -27,6 +27,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed ### Fixed
- Waiting for double click interval on modules that don't have a double click action ([`#2663`](https://github.com/polybar/polybar/issues/2663), [`#2695`](https://github.com/polybar/polybar/pull/2695)) - Waiting for double click interval on modules that don't have a double click action ([`#2663`](https://github.com/polybar/polybar/issues/2663), [`#2695`](https://github.com/polybar/polybar/pull/2695))
- Error reporting for deprecated config values ([`#2724`](https://github.com/polybar/polybar/issues/2724))
## [3.6.3] - 2022-05-04 ## [3.6.3] - 2022-05-04
### Fixed ### Fixed

View File

@ -226,6 +226,11 @@ class config {
} catch (const key_error& err) { } catch (const key_error& err) {
return get<T>(section, newkey, fallback); return get<T>(section, newkey, fallback);
} }
catch (const std::exception& err) {
m_log.err("Invalid value for \"%s.%s\", using fallback key \"%s.%s\" (reason: %s)",
section, old, section, newkey, err.what());
return get<T>(section, newkey, fallback);
}
} }
/** /**

View File

@ -131,12 +131,7 @@ bar::bar(connection& conn, signal_emitter& emitter, const config& config, const
m_log.info("Loaded monitor %s (%ix%i+%i+%i)", m_opts.monitor->name, m_opts.monitor->w, m_opts.monitor->h, m_log.info("Loaded monitor %s (%ix%i+%i+%i)", m_opts.monitor->name, m_opts.monitor->w, m_opts.monitor->h,
m_opts.monitor->x, m_opts.monitor->y); m_opts.monitor->x, m_opts.monitor->y);
try { m_opts.override_redirect = m_conf.deprecated(bs, "dock", "override-redirect", m_opts.override_redirect);
m_opts.override_redirect = m_conf.get<bool>(bs, "dock");
m_conf.warn_deprecated(bs, "dock", "override-redirect");
} catch (const key_error& err) {
m_opts.override_redirect = m_conf.get(bs, "override-redirect", m_opts.override_redirect);
}
m_opts.dimvalue = m_conf.get(bs, "dim-value", 1.0); m_opts.dimvalue = m_conf.get(bs, "dim-value", 1.0);
m_opts.dimvalue = math_util::cap(m_opts.dimvalue, 0.0, 1.0); m_opts.dimvalue = math_util::cap(m_opts.dimvalue, 0.0, 1.0);