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

making error msg for malformed packages.yml better #2078

Merged
merged 5 commits into from
Feb 11, 2020
Merged
Changes from 2 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
14 changes: 13 additions & 1 deletion core/dbt/config/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,18 @@
--no-version-check
"""

MALFORMED_PACKAGE_ERROR = """\
The packages.yml file in this project is malformed. Please double check the contents
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see that our style guide checker (flake8) failed with this error:

core/dbt/config/project.py:63:80: E501 line too long (84 > 79 characters)

Can you just split this onto two lines to appease flake8? Thanks!

of this file and fix any errors before retrying.

You can find more information on the syntax for this file here:
https://docs.getdbt.com/docs/package-management

Validator Error:
{error}
https://docs.getdbt.com/docs/package-management#section-how-do-i-add-a-package-to-my-project
"""


def _list_if_none(value):
if value is None:
Expand Down Expand Up @@ -130,7 +142,7 @@ def package_config_from_data(packages_data):
packages = PackageConfig.from_dict(packages_data)
except ValidationError as e:
raise DbtProjectError(
'Invalid package config: {}'.format(validator_error_message(e))
MALFORMED_PACKAGE_ERROR.format(error=str(e))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ooops - I think I led you astray here - we're actually going to want str(e.message)

Suggested change
MALFORMED_PACKAGE_ERROR.format(error=str(e))
MALFORMED_PACKAGE_ERROR.format(error=str(e.msg))

In practice, this should result in output like:

Screen Shot 2020-01-31 at 10 45 06 AM

Which i think is pretty good all things considered!

Note: we'll also want to remove the duplicated link on line 71!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the review!

) from e
return packages

Expand Down