Skip to content

Commit

Permalink
Merge pull request #1023 from pierre-nedelec/pierre-nedelec/issue1022
Browse files Browse the repository at this point in the history
Clearer BIDSValidation error message
  • Loading branch information
effigies authored Sep 6, 2023
2 parents f0d198d + 5dd012f commit 3100601
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions bids/layout/validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ def validate_root(root, validate):
if description is None:
raise BIDSValidationError(
"'dataset_description.json' is not a valid json file."
" There is likely a typo in your 'dataset_description.json'."
" There is likely a typo in your 'dataset_description.json' at "
f"{target.resolve()}. "
"\nExample contents of 'dataset_description.json': \n%s" %
json.dumps(EXAMPLE_BIDS_DESCRIPTION)
) from err
Expand All @@ -102,7 +103,8 @@ def validate_root(root, validate):
if k not in description:
raise BIDSValidationError(
"Mandatory %r field missing from "
"'dataset_description.json'."
"'dataset_description.json' at "
f"{target.resolve()}. "
"\nExample: %s" % (k, MANDATORY_BIDS_FIELDS[k])
)

Expand Down Expand Up @@ -130,7 +132,8 @@ def validate_derivative_path(path, **kwargs):
raise BIDSDerivativesValidationError(
"Every valid BIDS-derivatives dataset must "
"have a GeneratedBy.Name field set "
"inside 'dataset_description.json'. "
"inside 'dataset_description.json', "
f"here {dd.resolve()}. "
f"\nExample: {MANDATORY_DERIVATIVES_FIELDS['GeneratedBy']}"
)
return pipeline_name
Expand Down

0 comments on commit 3100601

Please sign in to comment.