Skip to content

Commit 1833a12

Browse files
oestebaneffigies
andauthored
Apply suggestions from code review
Co-authored-by: Chris Markiewicz <[email protected]>
1 parent bbcd4ff commit 1833a12

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

nipype/pipeline/plugins/base.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,10 +199,14 @@ def run(self, graph, config, updatehash=False):
199199

200200
if errors:
201201
# If one or more nodes failed, re-rise first of them
202-
if isinstance(errors[0], str):
203-
raise RuntimeError(errors[0])
202+
error, cause = errors[0], None
203+
if isinstance(error, str):
204+
error = RuntimeError(error)
204205

205-
raise errors[0]
206+
if len(errors) > 1:
207+
error, cause = RuntimeError(f"{len(errors)} raised. Re-raising first."), error
208+
209+
raise error from cause
206210

207211
def _get_result(self, taskid):
208212
raise NotImplementedError

nipype/pipeline/plugins/tests/test_sgelike.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ def test_crashfile_creation(tmp_path):
2929
sgelike_plugin = SGELikeBatchManagerBase("")
3030
with pytest.raises(RuntimeError) as e:
3131
assert pipe.run(plugin=sgelike_plugin)
32-
assert str(e.value) == "Workflow did not execute cleanly. Check log for details"
3332

3433
crashfiles = list(tmp_path.glob("crash*crasher*.pklz")) + list(
3534
tmp_path.glob("crash*crasher*.txt")

0 commit comments

Comments
 (0)