Adding error output for Tag Matcher on Travis (#5780)

I was unable to reproduce issue of decoding non UTF-8 characters. But these lines of code should provide output on which file has the bad character.
This commit is contained in:
Mykhailo Bykhovtsev
2018-12-18 10:39:32 -08:00
committed by Erki
parent 83963cdca3
commit 97fd11ad54

View File

@@ -75,8 +75,13 @@ for root, subdirs, files in walk(args.dir):
# For each file, generate the match dictionary.
matches[file_path] = populate_match_list()
for x in f:
# Then for each line in the file, conduct the tuple open/close matching.
get_tag_matches(matches[file_path], x)
try:
# Then for each line in the file, conduct the tuple open/close matching.
get_tag_matches(matches[file_path], x)
except UnicodeDecodeError:
print("There is a non UTF-8 format character in file {}. Line:\n\r{}".format(f, x))
exit(0)
# Pretty printing section.
# Loops over all matches and checks if there is a mismatch of tags.