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

Empty config file leads to confusing error message #1420

Closed
2 tasks
micahellison opened this issue Feb 26, 2022 · 0 comments · Fixed by #1461
Closed
2 tasks

Empty config file leads to confusing error message #1420

micahellison opened this issue Feb 26, 2022 · 0 comments · Fixed by #1461
Labels
bug Something isn't working 📌 This can't go stale ready for pr Okay to start work. Feel free to ask questions.
Milestone

Comments

@micahellison
Copy link
Member

Bug Report

Environment

  • jrnl --diagnostic output:
jrnl: v2.8.4-beta2
Python: 3.8.2 (tags/v3.8.2:7b3ab59, Feb 25 2020, 23:03:10) [MSC v.1916 64 bit (AMD64)]
OS: Windows 10
  • Install method: pipx

Current Behavior

If your config file is empty, you get a stack trace and a TypeError: 'NoneType' object is not iterable message.

Expected Behavior

It would be nice to have an error message that explains that the config file can't be parsed. Maybe show the path of the config file too.

Repro Steps

  • Empty the contents of your jrnl.yaml config file and save it
  • Run jrnl

Other Information

Stack trace:

Traceback (most recent call last):
  File "c:\users\micah\.pyenv\pyenv-win\versions\3.8.2\lib\runpy.py", line 193, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "c:\users\micah\.pyenv\pyenv-win\versions\3.8.2\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\Users\micah\.local\bin\jrnl.exe\__main__.py", line 7, in <module>
  File "C:\Users\micah\.local\pipx\venvs\jrnl\lib\site-packages\jrnl\cli.py", line 34, in cli
    return run(args)
  File "C:\Users\micah\.local\pipx\venvs\jrnl\lib\site-packages\jrnl\jrnl.py", line 39, in run
    config = install.load_or_install_jrnl(args.config_file_path)
  File "C:\Users\micah\.local\pipx\venvs\jrnl\lib\site-packages\jrnl\install.py", line 92, in load_or_install_jrnl
    upgrade_config(config, alt_config_path)
  File "C:\Users\micah\.local\pipx\venvs\jrnl\lib\site-packages\jrnl\install.py", line 28, in upgrade_config
    missing_keys = set(default_config).difference(config_data)
TypeError: 'NoneType' object is not iterable

A resolution to this issue should have:

  • An easy-to-understand error message when the config file can't be parsed
  • A BDD test that confirms the error message appears with an empty config file
@micahellison micahellison added bug Something isn't working 🆕 New! 📌 This can't go stale ready for pr Okay to start work. Feel free to ask questions. and removed 🆕 New! labels Feb 26, 2022
@micahellison micahellison added this to the Backlog milestone Mar 12, 2022
@micahellison micahellison linked a pull request May 7, 2022 that will close this issue
4 tasks
@wren wren closed this as completed in #1461 May 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working 📌 This can't go stale ready for pr Okay to start work. Feel free to ask questions.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant