Skip to content

Commit

Permalink
Improve error message about iteration parameters size problem
Browse files Browse the repository at this point in the history
  • Loading branch information
sapetnioc committed Oct 16, 2024
1 parent c9cea08 commit 9ccc2c5
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions capsul/pipeline/process_iteration.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,30 +205,30 @@ def _run_process(self):
if size is None:
size = psize
elif size != psize:
size_error = True
size_error = f'{parameter} (size {psize} != {size})'
break
if trait.output:
if no_output_value is None:
no_output_value = False
elif no_output_value:
size_error = True
size_error = f'{parameter} (size = {psize} but other parameter has no value)'
break
else:
if trait.output:
if no_output_value is None:
no_output_value = True
elif not no_output_value:
size_error = True
size_error = f'{parameter} (size = {psize}, has no value)'
break
else:
if size is None:
size = psize
elif size != psize:
size_error = True
size_error = f'{parameter} (size {psize} != {size})'
break

if size_error:
raise ValueError('Iterative parameter values must be lists of the same size: %s' % ','.join('%s=%d' % (n, len(getattr(self,n))) for n in iterative_parameters))
raise ValueError(f'Iterative parameter {size_error} values must be lists of the same size: %s' % ', '.join('%s=%d' % (n, len(getattr(self,n))) for n in iterative_parameters))
if size == 0:
return

Expand Down

0 comments on commit 9ccc2c5

Please sign in to comment.