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

Suggest webviz docs if user gives incorrect configuration #456

Merged
merged 1 commit into from
May 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [UNRELEASED] - YYYY-MM-DD

### Added
- [#456](https://github.com/equinor/webviz-config/pull/456) - Extended error message
when configuration file is invalid with suggestion to run `webviz docs`.
- [#426](https://github.com/equinor/webviz-config/pull/426) - Added centralized factory
registry exposed through `WEBVIZ_FACTORY_REGISTRY` for sharing factories between plugins.
- [#443](https://github.com/equinor/webviz-config/pull/443) - Added `--logconfig` command
Expand Down
14 changes: 10 additions & 4 deletions webviz_config/_config_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,10 @@ def _call_signature(
if arg not in SPECIAL_ARGS and arg not in kwargs:
raise ParserError(
f"{terminal_colors.RED}{terminal_colors.BOLD}"
f"`{plugin_name}` requires the argument "
f"`{arg}` in your configuration file."
f"The plugin `{plugin_name}` requires the argument "
f"`{arg}` in your configuration file. "
"Run the command `webviz docs` if you want "
"to see documentation of the plugin."
f"{terminal_colors.END}"
)

Expand Down Expand Up @@ -85,7 +87,9 @@ def _call_signature(
raise ParserError(
f"{terminal_colors.RED}{terminal_colors.BOLD}"
f"Unrecognized argument. `{plugin_name}` "
f"does not take an argument `{arg}`."
f"does not take an argument `{arg}`. "
"Run the command `webviz docs` if you want "
"to see documentation of the plugin."
f"{terminal_colors.END}"
)

Expand All @@ -107,7 +111,9 @@ def _call_signature(
f"given to `{plugin_name}` is "
f"of type `{type(kwargs[arg]).__name__}`. "
f"Expected type "
f"`{argspec.annotations[arg].__name__}`."
f"`{argspec.annotations[arg].__name__}`. "
"Run the command `webviz docs` if you want "
"to see documentation of the plugin."
f"{terminal_colors.END}"
)
# Typechecking typing classes does not work in python 3.7
Expand Down