summaryrefslogtreecommitdiff
path: root/coverage/lcovreport.py
diff options
context:
space:
mode:
Diffstat (limited to 'coverage/lcovreport.py')
-rw-r--r--coverage/lcovreport.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/coverage/lcovreport.py b/coverage/lcovreport.py
index b9fe2568..37e03b05 100644
--- a/coverage/lcovreport.py
+++ b/coverage/lcovreport.py
@@ -68,7 +68,15 @@ class LcovReporter:
# characters of the encoding ("==") are removed from the hash to
# allow genhtml to run on the resulting lcov file.
if source_lines:
- line = source_lines[covered-1].encode("utf-8")
+ try:
+ line = source_lines[covered-1].encode("utf-8")
+ except:
+ print(f"Failure processing {fr.filename!r}:")
+ with open(fr.filename) as f:
+ print("=" * 80)
+ print(f.read())
+ print("=" * 80)
+ raise
else:
line = b""
hashed = base64.b64encode(md5(line).digest()).decode().rstrip("=")