diff options
author | Lionel Flandrin | 2021-06-26 17:50:44 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2021-07-11 07:36:20 +0000 |
commit | 9c02a1b070b90668c97968b848421ad2de9d459b (patch) | |
tree | 4733175e095f59f26d37c18bfea9e9c0ae202946 /helix-view | |
parent | 3e4cd8f8e6456fdea4f0e82908d395eb516e1be6 (diff) |
Make command implementation return a Result<()>
The error message is displayed with cx.editor.set_error.
Diffstat (limited to 'helix-view')
-rw-r--r-- | helix-view/src/editor.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs index 4f01cce4..c80535ed 100644 --- a/helix-view/src/editor.rs +++ b/helix-view/src/editor.rs @@ -97,16 +97,17 @@ impl Editor { self._refresh(); } - pub fn set_theme_from_name(&mut self, theme: &str) { + 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); - return; + anyhow::bail!("failed setting theme `{}` - {}", theme, e); } }; self.set_theme(theme); + Ok(()) } fn _refresh(&mut self) { |