We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
chg: be more precise in error message on config file.
We can be more helpful when the main config file throws a parser error.


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `cookiecutter/config.py`
Content:
```
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3 
4 """
5 cookiecutter.config
6 -------------------
7 
8 Global configuration handling
9 """
10 
11 from __future__ import unicode_literals
12 import copy
13 import logging
14 import os
15 import io
16 
17 import yaml
18 
19 from .exceptions import ConfigDoesNotExistException
20 from .exceptions import InvalidConfiguration
21 
22 
23 logger = logging.getLogger(__name__)
24 
25 DEFAULT_CONFIG = {
26     'cookiecutters_dir': os.path.expanduser('~/.cookiecutters/'),
27     'replay_dir': os.path.expanduser('~/.cookiecutter_replay/'),
28     'default_context': {}
29 }
30 
31 
32 def get_config(config_path):
33     """
34     Retrieve the config from the specified path, returning it as a config dict.
35     """
36 
37     if not os.path.exists(config_path):
38         raise ConfigDoesNotExistException
39 
40     logger.debug('config_path is {0}'.format(config_path))
41     with io.open(config_path, encoding='utf-8') as file_handle:
42         try:
43             yaml_dict = yaml.safe_load(file_handle)
44         except yaml.scanner.ScannerError:
45             raise InvalidConfiguration(
46                 '{0} is no a valid YAML file'.format(config_path))
47 
48     config_dict = copy.copy(DEFAULT_CONFIG)
49     config_dict.update(yaml_dict)
50 
51     return config_dict
52 
53 
54 def get_user_config():
55     """
56     Retrieve config from the user's ~/.cookiecutterrc, if it exists.
57     Otherwise, return None.
58     """
59 
60     # TODO: test on windows...
61     USER_CONFIG_PATH = os.path.expanduser('~/.cookiecutterrc')
62 
63     if os.path.exists(USER_CONFIG_PATH):
64         return get_config(USER_CONFIG_PATH)
65     return copy.copy(DEFAULT_CONFIG)
66
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/cookiecutter/config.py b/cookiecutter/config.py
--- a/cookiecutter/config.py
+++ b/cookiecutter/config.py
@@ -41,9 +41,12 @@
     with io.open(config_path, encoding='utf-8') as file_handle:
         try:
             yaml_dict = yaml.safe_load(file_handle)
-        except yaml.scanner.ScannerError:
+        except yaml.scanner.ScannerError as e:
             raise InvalidConfiguration(
-                '{0} is no a valid YAML file'.format(config_path))
+                '{0} is not a valid YAML file: line {1}: {2}'.format(
+                    config_path,
+                    e.problem_mark.line,
+                    e.problem))
 
     config_dict = copy.copy(DEFAULT_CONFIG)
     config_dict.update(yaml_dict)

{"golden_diff": "diff --git a/cookiecutter/config.py b/cookiecutter/config.py\n--- a/cookiecutter/config.py\n+++ b/cookiecutter/config.py\n@@ -41,9 +41,12 @@\n     with io.open(config_path, encoding='utf-8') as file_handle:\n         try:\n             yaml_dict = yaml.safe_load(file_handle)\n-        except yaml.scanner.ScannerError:\n+        except yaml.scanner.ScannerError as e:\n             raise InvalidConfiguration(\n-                '{0} is no a valid YAML file'.format(config_path))\n+                '{0} is not a valid YAML file: line {1}: {2}'.format(\n+                    config_path,\n+                    e.problem_mark.line,\n+                    e.problem))\n \n     config_dict = copy.copy(DEFAULT_CONFIG)\n     config_dict.update(yaml_dict)\n", "issue": "chg: be more precise in error message on config file.\nWe can be more helpful when the main config file throws a parser error.\n\n", "before_files": [{"content": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\"\"\"\ncookiecutter.config\n-------------------\n\nGlobal configuration handling\n\"\"\"\n\nfrom __future__ import unicode_literals\nimport copy\nimport logging\nimport os\nimport io\n\nimport yaml\n\nfrom .exceptions import ConfigDoesNotExistException\nfrom .exceptions import InvalidConfiguration\n\n\nlogger = logging.getLogger(__name__)\n\nDEFAULT_CONFIG = {\n    'cookiecutters_dir': os.path.expanduser('~/.cookiecutters/'),\n    'replay_dir': os.path.expanduser('~/.cookiecutter_replay/'),\n    'default_context': {}\n}\n\n\ndef get_config(config_path):\n    \"\"\"\n    Retrieve the config from the specified path, returning it as a config dict.\n    \"\"\"\n\n    if not os.path.exists(config_path):\n        raise ConfigDoesNotExistException\n\n    logger.debug('config_path is {0}'.format(config_path))\n    with io.open(config_path, encoding='utf-8') as file_handle:\n        try:\n            yaml_dict = yaml.safe_load(file_handle)\n        except yaml.scanner.ScannerError:\n            raise InvalidConfiguration(\n                '{0} is no a valid YAML file'.format(config_path))\n\n    config_dict = copy.copy(DEFAULT_CONFIG)\n    config_dict.update(yaml_dict)\n\n    return config_dict\n\n\ndef get_user_config():\n    \"\"\"\n    Retrieve config from the user's ~/.cookiecutterrc, if it exists.\n    Otherwise, return None.\n    \"\"\"\n\n    # TODO: test on windows...\n    USER_CONFIG_PATH = os.path.expanduser('~/.cookiecutterrc')\n\n    if os.path.exists(USER_CONFIG_PATH):\n        return get_config(USER_CONFIG_PATH)\n    return copy.copy(DEFAULT_CONFIG)\n", "path": "cookiecutter/config.py"}], "after_files": [{"content": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\"\"\"\ncookiecutter.config\n-------------------\n\nGlobal configuration handling\n\"\"\"\n\nfrom __future__ import unicode_literals\nimport copy\nimport logging\nimport os\nimport io\n\nimport yaml\n\nfrom .exceptions import ConfigDoesNotExistException\nfrom .exceptions import InvalidConfiguration\n\n\nlogger = logging.getLogger(__name__)\n\nDEFAULT_CONFIG = {\n    'cookiecutters_dir': os.path.expanduser('~/.cookiecutters/'),\n    'replay_dir': os.path.expanduser('~/.cookiecutter_replay/'),\n    'default_context': {}\n}\n\n\ndef get_config(config_path):\n    \"\"\"\n    Retrieve the config from the specified path, returning it as a config dict.\n    \"\"\"\n\n    if not os.path.exists(config_path):\n        raise ConfigDoesNotExistException\n\n    logger.debug('config_path is {0}'.format(config_path))\n    with io.open(config_path, encoding='utf-8') as file_handle:\n        try:\n            yaml_dict = yaml.safe_load(file_handle)\n        except yaml.scanner.ScannerError as e:\n            raise InvalidConfiguration(\n                '{0} is not a valid YAML file: line {1}: {2}'.format(\n                    config_path,\n                    e.problem_mark.line,\n                    e.problem))\n\n    config_dict = copy.copy(DEFAULT_CONFIG)\n    config_dict.update(yaml_dict)\n\n    return config_dict\n\n\ndef get_user_config():\n    \"\"\"\n    Retrieve config from the user's ~/.cookiecutterrc, if it exists.\n    Otherwise, return None.\n    \"\"\"\n\n    # TODO: test on windows...\n    USER_CONFIG_PATH = os.path.expanduser('~/.cookiecutterrc')\n\n    if os.path.exists(USER_CONFIG_PATH):\n        return get_config(USER_CONFIG_PATH)\n    return copy.copy(DEFAULT_CONFIG)\n", "path": "cookiecutter/config.py"}]}