diff options
author | Michael Davis | 2022-12-15 08:49:49 +0000 |
---|---|---|
committer | GitHub | 2022-12-15 08:49:49 +0000 |
commit | db939801ebf299f11a6a52bdff7a3c9bfb87fc34 (patch) | |
tree | 9799f321762264bff47ba46519f404578740c7bf /helix-term/src | |
parent | 012fc12f97f4e8e0fc38af351388e41e8bc142d8 (diff) |
Improve error message handling for theme loading failures (#5073)
The error messages for a theme that failed to be deserialized (or
otherwise failed to load) were covered up by the context/with_context
calls:
* The log message for a bad theme configured in config.toml would only
say "Failed to deserilaize theme"
* Selecting a bad theme via :theme would show "Theme does not exist"
With these changes, we let the TOML deserializer errors bubble up, so
the error messages can now say the line number of a duplicated
key - and that key's name - when a theme fails to load because of a
duplicated key.
Providing a theme which does not exist to :theme still gives a helpful
error message: "No such file or directory."
Diffstat (limited to 'helix-term/src')
-rw-r--r-- | helix-term/src/commands/typed.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/helix-term/src/commands/typed.rs b/helix-term/src/commands/typed.rs index 2119a48d..cb387fcb 100644 --- a/helix-term/src/commands/typed.rs +++ b/helix-term/src/commands/typed.rs @@ -777,7 +777,7 @@ fn theme( .editor .theme_loader .load(theme_name) - .with_context(|| "Theme does not exist")?; + .map_err(|err| anyhow::anyhow!("Could not load theme: {}", err))?; if !(true_color || theme.is_16_color()) { bail!("Unsupported theme: theme requires true color support"); } |