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 <[email protected]>
  • Loading branch information
scott-huberty and effigies committed Oct 8, 2024
1 parent cfa80c0 commit 4e0b503
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(
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 4e0b503

Please sign in to comment.