From c8d064b447164ecc6737e943bace752cf5a089ba Mon Sep 17 00:00:00 2001 From: "maruel@chromium.org" Date: Mon, 16 Aug 2010 16:46:14 +0000 Subject: [PATCH] Add back stack location to gclient exceptions. Needed to use the special 3 args raise notation. Review URL: http://codereview.chromium.org/3164014 git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@56209 0039d316-1c4b-4281-b951-d872f2087c98 --- gclient_utils.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/gclient_utils.py b/gclient_utils.py index b2b009314..07a8aeba7 100644 --- a/gclient_utils.py +++ b/gclient_utils.py @@ -471,8 +471,10 @@ class ExecutionQueue(object): self.ready_cond.release() assert not self.running, 'Now guaranteed to be single-threaded' if self.exceptions: - # TODO(maruel): Get back the original stack location. - raise self.exceptions.pop(0) + # To get back the stack location correctly, the raise a, b, c form must be + # used, passing a tuple as the first argument doesn't work. + e = self.exceptions.pop(0) + raise e[0], e[1], e[2] if self.progress: self.progress.end() @@ -491,9 +493,9 @@ class ExecutionQueue(object): exception = None try: self.item.run(*self.args, **self.kwargs) - except Exception, e: - # TODO(maruel): Catch exception location. - exception = e + except Exception: + # Catch exception location. + exception = sys.exc_info() # This assumes the following code won't throw an exception. Bad. self.parent.ready_cond.acquire()