Repository: dbt-labs/dbt-core
Pull request: making error msg for malformed packages.yml better
I messed up the [previous](https://github.com/fishtown-analytics/dbt/pull/2077) PR during rebase and it was automatically closed. Here's new and clean one.

Fixes #2017

Problem statement:
Unhelpful error message with malformed packages.yml
### Describe the bug
```
MacBook-Pro:analytics tristan$ cat packages.yml
packages:
  - package: fishtown-analytics/stripe
    revision: 0.3.1
```

I had recently switched from a git reference to this package to a hub reference, and forgot that I needed to change from `revision` to `version`. This is the error message I received, which made it significantly more challenging to debug:

```
MacBook-Pro:analytics tristan$ dbt clean && dbt deps
Running with dbt=0.15.0
Encountered an error while reading the project:
  ERROR: Runtime Error
  Invalid package config: at path []: 'local' is a required property
```

### Expected behavior
I would expect an error message like:
```
Required parameter version not supplied.
```
...or something similar.

**The output of `dbt --version`:**
```
MacBook-Pro:analytics tristan$ dbt --version
installed version: 0.15.0
   latest version: 0.15.0

Up to date!
```

Hints from issue discussion:
well `local` is actually also valid error, since it could be the case if package is stored locally. I can suggest error msg like `packages.yml is malformed, please make sure that it matches https://docs.getdbt.com/docs/package-management#section-how-do-i-add-a-package-to-my-project` 
good idea @sonac - are you interested in submitting a PR for that change? I think it should be a quick fix!

Commit message: making error msg for malformed packages.yml better

Patch to review:
diff --git a/core/dbt/config/project.py b/core/dbt/config/project.py
index 620aa0773bc..3fb5fc73f66 100644
--- a/core/dbt/config/project.py
+++ b/core/dbt/config/project.py
@@ -59,6 +59,11 @@
 --no-version-check
 """
 
+MALFORMED_PACKAGE_ERROR = """\
+packages.yml is malformed, please make sure that it matches 
+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:
@@ -130,7 +135,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
         ) from e
     return packages
 


Code review comments:
diff_hunk: @@ -59,6 +59,11 @@
 --no-version-check
 """
 
+MALFORMED_PACKAGE_ERROR = """\
+packages.yml is malformed, please make sure that it matches 
path: core/dbt/config/project.py
text: @user1:
Check out these copy suggestions. Couple of things:
1. We like using full sentences in these error messages
2. I picked a more generic link so we don't accidentally break this in the docs in the future
3. We should retain the error message (see below) in this error output

```suggestion
The packages.yml file in this project is malformed. Please double check the contents
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}
```

@author:
noted, though regarding validation error retainment - the initial issue was raised that it is misleading, so i was doubtful regarding including it into the message

diff_hunk: @@ -130,7 +135,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
path: core/dbt/config/project.py
text: @user1:
Let's retain the error message here. It is helpful, and it definitely benefits from some additional context. I think the stringified error message is a little bit easier to understand than the output of `validator_error_message()` here though

```suggestion
            MALFORMED_PACKAGE_ERROR.format(error=str(e))
```