Skip to content

Commit

Permalink
FIX: improve evaluate_connect_function error handling.
Browse files Browse the repository at this point in the history
This incorporates Chris's suggestions from #3655 (comment)

Except I raise a new error and include the original error message (instead of revising the original error message).

Co-authored-by: Chris Markiewicz <effigies@gmail.com>
  • Loading branch information
scott-huberty and effigies committed Oct 10, 2024
1 parent 469d0c6 commit df241b2
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions nipype/pipeline/engine/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -689,15 +689,10 @@ def evaluate_connect_function(function_source, args, first_arg):
try:
output_value = func(first_arg, *list(args))
except NameError as e:
if e.args[0].endswith("is not defined"):
e.args = (
e.args[0],
(
"Due to engine constraints all imports have to be done "
"inside each function definition"
),
)
raise e
raise NameError(

Check warning on line 692 in nipype/pipeline/engine/utils.py

View check run for this annotation

Codecov / codecov/patch

nipype/pipeline/engine/utils.py#L692

Added line #L692 was not covered by tests
f"{e}: Due to engine constraints all imports have to be done inside each "
" function definition."
)
return output_value


Expand Down

0 comments on commit df241b2

Please sign in to comment.