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

Provide clearer error message when repository entry is empty #256

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

christophebedard
Copy link
Contributor

@christophebedard christophebedard commented Mar 26, 2023

Fixes #255

The parsing code (get_repos_in_vcstool_format()) already provides a useful error message when an attribute is missing (e.g., url:). However, as shown in the issue above, it doesn't handle/detect empty repository entries. Therefore, check if the repository is empty before trying to access its attributes. Otherwise, provide a useful error message:

$ cat bad.repos
repositories:
  empty_entry:
  missing_url:
    type: git
$ vcs validate --input bad.repos 
Repository 'empty_entry' is empty
Repository 'missing_url' does not provide the necessary information: 'url'

Before this change, validation fails on empty_entry (and does not validate missing_url):

$ vcs validate --input bad.repos 
Input data is not valid format: 'NoneType' object is not subscriptable

I've also updated the tests to cover this.

Signed-off-by: Christophe Bedard <bedard.christophe@gmail.com>
@caioaamaral
Copy link

friendly ping @dirk-thomas

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

Successfully merging this pull request may close these issues.

bad non-descriptive error message 'NoneType' object is not subscriptable
2 participants