File tree Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -267,7 +267,7 @@ def load_json(path):
267267 with open (path , 'r' , encoding = 'utf-8' ) as handle :
268268 try :
269269 return json .load (handle )
270- except json .JSONDecodeError as e :
270+ except ( UnicodeDecodeError , json .JSONDecodeError ) as e :
271271 msg = f"Error occurred while trying to decode JSON from file { path } "
272272 raise IOError (msg ) from e
273273
Original file line number Diff line number Diff line change @@ -79,11 +79,13 @@ def validate_root(root, validate):
7979 else :
8080 description = None
8181 else :
82+ err = None
8283 try :
8384 with open (target , 'r' , encoding = 'utf-8' ) as desc_fd :
8485 description = json .load (desc_fd )
85- except json .JSONDecodeError :
86+ except ( UnicodeDecodeError , json .JSONDecodeError ) as e :
8687 description = None
88+ err = e
8789 if validate :
8890
8991 if description is None :
@@ -92,7 +94,7 @@ def validate_root(root, validate):
9294 " There is likely a typo in your 'dataset_description.json'."
9395 "\n Example contents of 'dataset_description.json': \n %s" %
9496 json .dumps (EXAMPLE_BIDS_DESCRIPTION )
95- )
97+ ) from err
9698
9799 for k in MANDATORY_BIDS_FIELDS :
98100 if k not in description :
You can’t perform that action at this time.
0 commit comments