[diffoscope] 03/05: Ensure decode errors in JSON comparator are not fatal.

Chris Lamb chris at chris-lamb.co.uk
Sat Aug 6 21:10:01 CEST 2016


This is an automated email from the git hooks/post-receive script.

lamby pushed a commit to branch master
in repository diffoscope.

commit 50be22f62f682fcec19adb452bb107ea5332c422
Author: Chris Lamb <lamby at debian.org>
Date:   Sat Aug 6 18:35:03 2016 +0100

    Ensure decode errors in JSON comparator are not fatal.
---
 diffoscope/comparators/json.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/diffoscope/comparators/json.py b/diffoscope/comparators/json.py
index a1235c6..06eae63 100644
--- a/diffoscope/comparators/json.py
+++ b/diffoscope/comparators/json.py
@@ -33,7 +33,10 @@ class JSONFile(File):
             return False
 
         with open(file.path) as f:
-            file.parsed = json.load(f)
+            try:
+                file.parsed = json.load(f)
+            except json.JSONDecodeError:
+                return False
 
         return True
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/diffoscope.git


More information about the diffoscope mailing list