1
1
mirror of https://github.com/wez/wezterm.git synced 2024-11-10 15:04:32 +03:00

log errors when a color scheme fails to load

refs: https://github.com/wez/wezterm/issues/794
This commit is contained in:
Wez Furlong 2021-05-15 13:39:31 -07:00
parent db45238769
commit 9b082edb8d
2 changed files with 19 additions and 11 deletions

View File

@ -1578,9 +1578,7 @@ impl Config {
fn load_scheme(path: &Path) -> Result<ColorSchemeFile, Error> {
let s = std::fs::read_to_string(path)?;
let scheme: ColorSchemeFile = toml::from_str(&s).with_context(|| {
format!("Error parsing color scheme TOML from {}", path.display())
})?;
let scheme: ColorSchemeFile = toml::from_str(&s).context("parsing TOML")?;
Ok(scheme)
}
@ -1596,14 +1594,23 @@ impl Config {
}
let path = entry.path();
if let Ok(scheme) = load_scheme(&path) {
log::trace!(
"Loaded color scheme `{}` from {}",
scheme_name,
path.display()
);
self.color_schemes
.insert(scheme_name.to_string(), scheme.colors);
match load_scheme(&path) {
Ok(scheme) => {
log::trace!(
"Loaded color scheme `{}` from {}",
scheme_name,
path.display()
);
self.color_schemes
.insert(scheme_name.to_string(), scheme.colors);
}
Err(err) => {
log::error!(
"Color scheme in `{}` failed to load: {:#}",
path.display(),
err
);
}
}
}
}

View File

@ -21,6 +21,7 @@ As features stabilize some brief notes about them will accumulate here.
* Fixed: we now recognize the `CSI 48:2:0:214:255m` form of specifying true color text attributes [#785](https://github.com/wez/wezterm/issues/785)
* Fixed: split separators didn't respect `tab_bar_at_bottom=true` and were rendered in the wrong place [#797](https://github.com/wez/wezterm/issues/797)
* Improved: messaging around [exit_behavior](https://wezfurlong.org/wezterm/config/lua/config/exit_behavior.html)
* Fixed: errors loading custom color schemes are now logged to the error log [#794](https://github.com/wez/wezterm/issues/794)
### 20210502-154244-3f7122cb