Make the exception user-friendly
Review URL: http://codereview.chromium.org/2866017
git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@50987 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/gclient.py b/gclient.py
index 55305bd..3a5a669 100644
--- a/gclient.py
+++ b/gclient.py
@@ -450,11 +450,15 @@
# Raise a new exception with the human readable message:
raise gclient_utils.Error('\n'.join(error_message))
for s in config_dict.get('solutions', []):
- self.dependencies.append(Dependency(
- self, s['name'], s['url'],
- s.get('safesync_url', None),
- s.get('custom_deps', {}),
- s.get('custom_vars', {})))
+ try:
+ self.dependencies.append(Dependency(
+ self, s['name'], s['url'],
+ s.get('safesync_url', None),
+ s.get('custom_deps', {}),
+ s.get('custom_vars', {})))
+ except KeyError:
+ raise gclient_utils.Error('Invalid .gclient file. Solution is '
+ 'incomplete: %s' % s)
# .gclient can have hooks.
self.deps_hooks = config_dict.get('hooks', [])