Skip to content

Commit

Permalink
ENH: raise exception if dcm2niix returns with non-0 code
Browse files Browse the repository at this point in the history
  • Loading branch information
yarikoptic committed Jul 20, 2023
1 parent 83c8424 commit 7904d46
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions heudiconv/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -827,7 +827,18 @@ def nipype_convert(
convertnode.terminal_output = "allatonce"
convertnode.inputs.bids_format = bids_options is not None
eg = convertnode.run()
if eg.runtime.returncode:
lgr.error(

Check warning on line 831 in heudiconv/convert.py

View check run for this annotation

Codecov / codecov/patch

heudiconv/convert.py#L831

Added line #L831 was not covered by tests
f"Conversion has failed with exit code {eg.runtime.returncode}.\n"
f" Produced files: {eg.outputs.converted_files}\n"
f" stdout: {eg.runtime.stdout}\n"
f" stderr: {eg.runtime.stderr}"
)
import pdb

Check warning on line 837 in heudiconv/convert.py

View check run for this annotation

Codecov / codecov/patch

heudiconv/convert.py#L837

Added line #L837 was not covered by tests

pdb.set_trace()

Check warning on line 839 in heudiconv/convert.py

View check run for this annotation

Codecov / codecov/patch

heudiconv/convert.py#L839

Added line #L839 was not covered by tests
# TODO: make an option on behavior in such cases -- error or to continue
raise RuntimeError("Conversion has failed. Check the logs for more details")

Check warning on line 841 in heudiconv/convert.py

View check run for this annotation

Codecov / codecov/patch

heudiconv/convert.py#L841

Added line #L841 was not covered by tests
# prov information
prov_file = prefix + "_prov.ttl" if with_prov else None
if prov_file:
Expand Down

0 comments on commit 7904d46

Please sign in to comment.