Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve error message handling for theme loading failures #5073

Merged

Conversation

the-mikedavis
Copy link
Member

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."

See #5043

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."
@the-mikedavis the-mikedavis added C-enhancement Category: Improvements S-waiting-on-review Status: Awaiting review from a maintainer. labels Dec 8, 2022
Copy link
Member

@pascalkuthe pascalkuthe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍 Sorry about closing that issue prematurely it seemed resolved to me on a technical level but a better error message is definitely the real fix to those kinds of issues

@kirawi kirawi added the A-helix-term Area: Helix term improvements label Dec 9, 2022
@archseer archseer merged commit db93980 into helix-editor:master Dec 15, 2022
@the-mikedavis the-mikedavis deleted the md-bad-theme-error-messages branch December 15, 2022 14:00
freqmod pushed a commit to freqmod/helix that referenced this pull request Feb 8, 2023
…or#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."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-helix-term Area: Helix term improvements C-enhancement Category: Improvements S-waiting-on-review Status: Awaiting review from a maintainer.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants