Skip to content

Commit

Permalink
Add information about syntax_style value in error message for theme…
Browse files Browse the repository at this point in the history
… validation (#5602)

# Description
<!-- What does this pull request (PR) do? Why is it necessary? -->
<!-- Tell us about your new feature, improvement, or fix! -->
<!-- If your change includes user interface changes, please add an
image, or an animation "An image is worth a thousand words!" -->
<!-- You can use https://www.cockos.com/licecap/ or similar to create
animations -->

The current message do not provide information about the used value that
is important to debug a problem.

## Type of change
<!-- Please delete options that are not relevant. -->
- [x] Bug-fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [ ] This change requires a documentation update

# References
<!-- What resources, documentation, and guides were used in the creation
of this PR? -->
<!-- If this is a bug-fix or otherwise resolves an issue, reference it
here with "closes #(issue)" -->

brisvag/napari-gruvbox#1

# How has this been tested?
<!-- Please describe the tests that you ran to verify your changes. -->
- [ ] example: the test suite for my feature covers cases x, y, and z
- [ ] example: all tests pass with my change
- [ ] example: I check if my changes works with both PySide and PyQt
backends
      as there are small differences between the two Qt bindings.  

## Final checklist:
- [ ] My PR is the minimum possible work for the desired functionality
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] If I included new strings, I have used `trans.` to make them
localizable.
For more information see our [translations
guide](https://napari.org/developers/translations.html).
  • Loading branch information
Czaki committed Mar 6, 2023
1 parent c43a2e7 commit 14f33d6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion napari/utils/theme.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,10 @@ def _ensure_syntax_style(value: str) -> str:
from pygments.styles import STYLE_MAP

assert value in STYLE_MAP, trans._(
"Incorrect `syntax_style` value provided. Please use one of the following: {syntax_style}",
"Incorrect `syntax_style` value: {value} provided. Please use one of the following: {syntax_style}",
deferred=True,
syntax_style=f" {', '.join(STYLE_MAP)}",
value=value,
)
return value

Expand Down

0 comments on commit 14f33d6

Please sign in to comment.