mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2026-03-31 18:46:53 +00:00
Displaying the filename when the check-json hook fails with a UnicodeDecodeError - fix #148
This commit is contained in:
parent
4ef03c4223
commit
54e83f7ceb
3 changed files with 9 additions and 2 deletions
|
|
@ -15,7 +15,7 @@ def check_json(argv=None):
|
|||
for filename in args.filenames:
|
||||
try:
|
||||
simplejson.load(open(filename))
|
||||
except simplejson.JSONDecodeError as exc:
|
||||
except (simplejson.JSONDecodeError, UnicodeDecodeError) as exc:
|
||||
print('{0}: Failed to json encode ({1})'.format(filename, exc))
|
||||
retval = 1
|
||||
return retval
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue