Skip to content

Commit

Permalink
Exception changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Joseph Schull committed Jul 11, 2024
1 parent 1f27a19 commit 66e5d12
Showing 1 changed file with 8 additions and 14 deletions.
22 changes: 8 additions & 14 deletions iohub/cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,19 +131,13 @@ def rename_wells_cli(csvfile, zarrfile):

modified = []

well_paths = [
plate.metadata.wells[i].path for i in range(len(plate.metadata.wells))
]

for old_well_path, new_well_path in names:
if old_well_path not in well_paths:
raise ValueError(
f"Old well path '{old_well_path}' not found "
f"in the plate metadata."
)
for well in plate.metadata.wells:
if well.path == old_well_path and well not in modified["wells"]:
plate.rename_well(
well, old_well_path, new_well_path, modified, False
)
modified["wells"].append(well)
if well.path == old_well_path and well not in modified:
try:
plate.rename_well(
well, old_well_path, new_well_path, modified, False
)
modified.append(well)
except ValueError as e:
click.echo(f"Error: {e}", err=True)

0 comments on commit 66e5d12

Please sign in to comment.