goofy: Minor refine for InitTestLists() error handling
The 'exc_info' serves only as a flag to indicate if there's an exception
raise in InitTestLists(). The logic for this exception handling can be
integrated in the except section natively.
BUG=none
TEST=make test
TEST=manually make a test list with syntax error
TEST=manually raise an exception from InitTestLists()
Change-Id: Ifd3d4add82677e02d8347593acfb533497178af1
Reviewed-on: https://chromium-review.googlesource.com/694801
Commit-Ready: Shen-En Shih <petershih@chromium.org>
Tested-by: Shen-En Shih <petershih@chromium.org>
Reviewed-by: Pi-Hsun Shih <pihsun@chromium.org>
diff --git a/py/goofy/goofy.py b/py/goofy/goofy.py
index 6e8bff3..febf3c3 100755
--- a/py/goofy/goofy.py
+++ b/py/goofy/goofy.py
@@ -1051,17 +1051,14 @@
AutomationModePrompt[self.options.automation_mode])
success = False
- exc_info = None
try:
success = self.InitTestLists()
except Exception:
- exc_info = sys.exc_info()
+ logging.exception('Unable to initialize test lists')
+ self._RecordStartError(
+ 'Unable to initialize test lists\n%s' % traceback.format_exc())
if not success:
- if exc_info:
- logging.exception('Unable to initialize test lists')
- self._RecordStartError(
- 'Unable to initialize test lists\n%s' % traceback.format_exc())
if self.options.ui == 'chrome':
# Create an empty test list with default options so that the rest of
# startup can proceed.