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 reporting when a config is malformed #175

Open
ymyzk opened this issue Apr 16, 2023 · 1 comment
Open

Improve error reporting when a config is malformed #175

ymyzk opened this issue Apr 16, 2023 · 1 comment

Comments

@ymyzk
Copy link
Owner

ymyzk commented Apr 16, 2023

Problem
When a given configuration is malformed (: must be used instead of =) like the following example (#174)

python =
    3.7 = py37
    3.8 = py38
...

tox-gh-actions reports user-unfriendly error like

return {k: StrConvert.to_env_list(v).envs for k, v in parse_dict(value).items()}
File "/opt/hostedtoolcache/Python/3.9.16/x64/lib/python3.9/site-packages/tox_gh_actions/plugin.py", line 264, in parse_dict
return dict((k.strip(), v.strip()) for k, v in pairs)
File "/opt/hostedtoolcache/Python/3.9.16/x64/lib/python3.9/site-packages/tox_gh_actions/plugin.py", line 264, in <genexpr>
return dict((k.strip(), v.strip()) for k, v in pairs)
ValueError: not enough values to unpack (expected 2, got 1)
Error: Process completed with exit code 1.

Idea
It's better to detect malformed configurations and show user-friendly error messages instead.

@bittner
Copy link

bittner commented May 22, 2023

I agree on reporting errors in a user-friendly manner.

The syntax, as shown off by your example, might be good to revise, though. = seems to work out better than : for Tox. Please see tox-dev/tox#3014 for some background.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants