From 4a3c17eab42c0ece7e5abf882e96c7f271d30bbb Mon Sep 17 00:00:00 2001 From: "szager@chromium.org" Date: Fri, 24 May 2013 23:59:29 +0000 Subject: [PATCH] Add job prefix to error messages. BUG=235289 R=maruel@chromium.org Review URL: https://codereview.chromium.org/15792004 git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@202236 0039d316-1c4b-4281-b951-d872f2087c98 --- gclient_utils.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/gclient_utils.py b/gclient_utils.py index 54d4e0ecf..d86f23c1d 100644 --- a/gclient_utils.py +++ b/gclient_utils.py @@ -22,8 +22,11 @@ import subprocess2 class Error(Exception): """gclient exception class.""" - pass - + def __init__(self, msg, *args, **kwargs): + index = getattr(threading.currentThread(), 'index', 0) + if index: + msg = '\n'.join('%d> %s' % (index, l) for l in msg.splitlines()) + super(Error, self).__init__(msg, *args, **kwargs) def SplitUrlRevision(url): """Splits url and returns a two-tuple: url, rev"""