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

making error msg for malformed packages.yml better #2078

merged 5 commits into from
Feb 11, 2020

Conversation

sonac
Copy link
Contributor

@sonac sonac commented Jan 30, 2020

I messed up the previous PR during rebase and it was automatically closed. Here's new and clean one.

Fixes #2017

@cla-bot cla-bot bot added the cla:yes label Jan 30, 2020
Copy link
Contributor

@drewbanin drewbanin left a comment

Choose a reason for hiding this comment

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

This is going to be really great! Check out some of my suggestions in here - happy to discuss if you feel differently about any of them :)

Nice work so far!

core/dbt/config/project.py Outdated Show resolved Hide resolved
core/dbt/config/project.py Outdated Show resolved Hide resolved
adding actual error text into wrapper

Co-Authored-By: Drew Banin <drew@fishtownanalytics.com>
Copy link
Contributor

@drewbanin drewbanin left a comment

Choose a reason for hiding this comment

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

Alright! One more round of changes, and then this PR will be ready to roll :)

@@ -135,7 +142,7 @@ def package_config_from_data(packages_data):
packages = PackageConfig.from_dict(packages_data)
except ValidationError as e:
raise DbtProjectError(
MALFORMED_PACKAGE_ERROR
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!

Copy link
Contributor

@drewbanin drewbanin left a comment

Choose a reason for hiding this comment

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

Looks great - merging this when the tests pass! Thanks for your contribution to dbt 😃 🎉

@@ -59,6 +59,17 @@
--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!

Copy link
Contributor

@drewbanin drewbanin left a comment

Choose a reason for hiding this comment

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

one more quick one and then this will be ready to merge :)

@@ -59,6 +59,17 @@
--no-version-check
"""

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

Choose a reason for hiding this comment

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

flake8 run-test: commands[0] | /bin/bash -c '$(which flake8) --select=E,W,F --ignore=W504 core/dbt plugins/*/dbt'
core/dbt/config/project.py:63:72: W291 trailing whitespace
Suggested change
The packages.yml file in this project is malformed. Please double check
The packages.yml file in this project is malformed. Please double check

@drewbanin
Copy link
Contributor

Thanks for sticking with this one @sonac! Merging this for our 0.16.0 release :D

@drewbanin drewbanin merged commit 25235a4 into dbt-labs:dev/barbara-gittings Feb 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unhelpful error message with malformed packages.yml
2 participants