Skip to content

Commit df241b2

Browse files
FIX: improve evaluate_connect_function error handling.
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 <[email protected]>
1 parent 469d0c6 commit df241b2

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

nipype/pipeline/engine/utils.py

+4-9
Original file line numberDiff line numberDiff line change
@@ -689,15 +689,10 @@ def evaluate_connect_function(function_source, args, first_arg):
689689
try:
690690
output_value = func(first_arg, *list(args))
691691
except NameError as e:
692-
if e.args[0].endswith("is not defined"):
693-
e.args = (
694-
e.args[0],
695-
(
696-
"Due to engine constraints all imports have to be done "
697-
"inside each function definition"
698-
),
699-
)
700-
raise e
692+
raise NameError(
693+
f"{e}: Due to engine constraints all imports have to be done inside each "
694+
" function definition."
695+
)
701696
return output_value
702697

703698

0 commit comments

Comments
 (0)