vstask icon indicating copy to clipboard operation
vstask copied to clipboard

Print message if task not in tasks.json

Open RamVasuthevan opened this issue 1 year ago • 0 comments

Currently, if we try to run a task that is not in tasks, we get a non-descriptive error like:

(Private-Website) ram@Rams-MacBook-Air ~/c/Private-Website (vstask-to-run-tasks)> vstask Create
Traceback (most recent call last):
  File "/Users/ram/.local/share/virtualenvs/Private-Website-b_cN1wWk/bin/vstask", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/Users/ram/.local/share/virtualenvs/Private-Website-b_cN1wWk/lib/python3.12/site-packages/vstask/vstask.py", line 92, in main
    if run_task(tasks[task_name], root) != 0:
                ~~~~~^^^^^^^^^^^
KeyError: 'Create'

We will now get a more useful error message like:

(vstask) ram@Rams-MacBook-Air ~/c/vstask (print-message-if-task-not-in-tasks-json)> vstask Create
Unable to find Create in tasks.json

RamVasuthevan avatar Oct 05 '24 18:10 RamVasuthevan