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 <grt@chromium.org>
Commit-Queue: Dirk Pranke <dpranke@google.com>
Reviewed-by: Dirk Pranke <dpranke@google.com>
changes/71/2928771/3
Greg Thompson 4 years ago committed by LUCI CQ
parent 424504a1b2
commit 30cde45e06

@ -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))

Loading…
Cancel
Save