diff options
author | Blaž Hrastnik | 2021-07-11 07:35:57 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2021-07-11 07:36:36 +0000 |
commit | d530d6e39d58f5759d2db0a9bda1ea5e21154f83 (patch) | |
tree | cb2b4f44ba93d69d31152a0e3bef1e727feb1af3 /helix-view/src | |
parent | 9c02a1b070b90668c97968b848421ad2de9d459b (diff) |
Further simplify error handling in :commands
Diffstat (limited to 'helix-view/src')
-rw-r--r-- | helix-view/src/editor.rs | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs index c80535ed..a468b87c 100644 --- a/helix-view/src/editor.rs +++ b/helix-view/src/editor.rs @@ -98,14 +98,11 @@ impl Editor { } pub fn set_theme_from_name(&mut self, theme: &str) -> anyhow::Result<()> { - let theme = match self.theme_loader.load(theme.as_ref()) { - Ok(theme) => theme, - Err(e) => { - log::warn!("failed setting theme `{}` - {}", theme, e); - anyhow::bail!("failed setting theme `{}` - {}", theme, e); - } - }; - + use anyhow::Context; + let theme = self + .theme_loader + .load(theme.as_ref()) + .with_context(|| format!("failed setting theme `{}`", theme))?; self.set_theme(theme); Ok(()) } |