From 81843b86ef6961d6e4c3f90438a16bd4c678a663 Mon Sep 17 00:00:00 2001 From: "maruel@chromium.org" Date: Mon, 28 Jun 2010 16:49:26 +0000 Subject: [PATCH] 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 --- gclient.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/gclient.py b/gclient.py index 55305bd8c..3a5a669bb 100644 --- a/gclient.py +++ b/gclient.py @@ -450,11 +450,15 @@ solutions = [ # 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', [])