Repository: dbt-labs/dbt-core
Pull request: Add more helpful error message for misconfiguration in profiles.yml
resolves [#2569](https://github.com/fishtown-analytics/dbt/issues/2569) 

### Description
Adds an additional catch for if the supplied target returns no data and returns a more helpful error message.


### Checklist
 - [X] I have signed the [CLA](https://docs.getdbt.com/docs/contributor-license-agreements)
 - [X] I have run this code in development and it appears to resolve the stated issue
 - [X] This PR includes tests, or tests are not required/relevant for this PR
 - [ ] I have updated the `CHANGELOG.md` and added information about my change to the "dbt next" section.  <-- not sure if this change warrants a mention quite yet but let me know if you'd like me to add.


### Further Validation
Additional screenshot of what the new terminal output looks like (tested against the example target referenced in the issue):
![image](https://user-images.githubusercontent.com/1820651/87601676-89244780-c6c3-11ea-9b41-4cacd500cfb5.png)


Problem statement:
Empty target in profiles.yml results in an unhelpful error message
### Steps to reproduce
1. Create a profile like so (note empty `learn:` key)
```
$ cat ~/.dbt/profiles.yml
jaffle_shop:
  target: learn

  outputs:
    learn:
```
2. Run `dbt debug --profile jaffle_shop`

### Expected behavior
A useful error message

### Actual behavior
```
$ dbt debug --profile jaffle_shop
Running with dbt=0.18.0-b1
dbt version: 0.18.0-b1
python version: 3.7.5
python path: /Users/claire/.pyenv/versions/3.7.5/envs/dbt-dev-v2/bin/python
os info: Darwin-19.4.0-x86_64-i386-64bit
Using profiles.yml file at /Users/claire/.dbt/profiles.yml
Using dbt_project.yml file at /Users/claire/clrcrl/jaffle_shop/dbt_project.yml

Encountered an error:
'NoneType' object has no attribute 'pop'

```

**The output of `dbt --version`:**
```
$ dbt --version
installed version: 0.18.0-b1
   latest version: 0.17.0

Your version of dbt is ahead of the latest release!

Plugins:
  - bigquery: 0.18.0b1
  - snowflake: 0.18.0b1
  - redshift: 0.18.0b1
  - postgres: 0.18.0b1
```

### Additional context
This came up because someone had their profile indented incorrectly:
```
jaffle_shop:
  target: learn

  outputs:
    learn:
    type: snowflake
    threads: 1
    account: ***
    ...
```

Hints from issue discussion:
just an fyi, im working on this now

Commit message: Add more helpful error message for misconfiguration in profiles.yml

Patch to review:
diff --git a/core/dbt/config/profile.py b/core/dbt/config/profile.py
index b3c145348ca..3da2936fdea 100644
--- a/core/dbt/config/profile.py
+++ b/core/dbt/config/profile.py
@@ -197,6 +197,11 @@ def _get_profile_data(
                    .format(profile_name, target_name, outputs))
             raise DbtProfileError(msg, result_type='invalid_target')
         profile_data = outputs[target_name]
+
+        if profile_data is None:
+            msg = (f"{target_name} is misconfigured in your profiles.yml")
+            raise DbtProfileError(msg, result_type='invalid_target')
+
         return profile_data
 
     @classmethod


Code review comments:
diff_hunk: @@ -197,6 +197,11 @@ def _get_profile_data(
                    .format(profile_name, target_name, outputs))
             raise DbtProfileError(msg, result_type='invalid_target')
         profile_data = outputs[target_name]
+
+        if profile_data is None:
path: core/dbt/config/profile.py
text: @user1:
It'd be good to check `if not isinstance(profile_data, dict)` instead - if it's anything but a dict, we know it's misconfigured.

diff_hunk: @@ -197,6 +197,11 @@ def _get_profile_data(
                    .format(profile_name, target_name, outputs))
             raise DbtProfileError(msg, result_type='invalid_target')
         profile_data = outputs[target_name]
+
+        if profile_data is None:
+            msg = (f"{target_name} is misconfigured in your profiles.yml")
path: core/dbt/config/profile.py
text: @user2:
```suggestion
            msg = (
                f"output '{target_name}' of profile '{profile_name}' is "
                f"misconfigured in profiles.yml"
            )
```

It'd be nice to point it at where the issue is a bit more clearly in large profiles, here's one way we could add the profile name in and show that we're talking about `outputs:` values.

@user1, do you have any other suggestions on the copy?