From 30cde45e06283ef80e0b5ce970cd5da9509cc0e8 Mon Sep 17 00:00:00 2001 From: Greg Thompson Date: Tue, 1 Jun 2021 16:38:47 +0000 Subject: [PATCH] Fix error handling in case of unicode decode error. Commit 6fc394f added some diagnostics, but it didn't quite work out the way it was planned. Bug: 1210746 Change-Id: Ia4f30606e87d3f8b1362441bd74bb7ed0f5ca886 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2928771 Auto-Submit: Greg Thompson Commit-Queue: Dirk Pranke Reviewed-by: Dirk Pranke --- presubmit_support.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/presubmit_support.py b/presubmit_support.py index b917a5995e..89643e2c77 100755 --- a/presubmit_support.py +++ b/presubmit_support.py @@ -1006,7 +1006,7 @@ class AffectedFile(object): self.AbsoluteLocalPath(), 'rU').splitlines() except IOError: pass # File not found? That's fine; maybe it was deleted. - except UnicodeDecodeError: + except UnicodeDecodeError as e: # log the filename since we're probably trying to read a binary # file, and shouldn't be. print('Error reading %s: %s' % (self.AbsoluteLocalPath(), e))