Skip to content

Commit

Permalink
Merge pull request #62 from Ankush0286/main
Browse files Browse the repository at this point in the history
Improved Error Handling
  • Loading branch information
Kota-Karthik authored Oct 4, 2024
2 parents 3c11cff + 8ec8eff commit a3ec579
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions twinTrim/flagController.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ def handleAllFlag(directory,file_filter,pb_color,bar_color):

# Update progress bar as files are processed
for future in as_completed(futures):
try:
future.result() # Ensures exception handling for each future
except Exception as e:
click.echo(click.style(f"Error processing file {futures[future]}: {str(e)}", fg='red'))
progress_bar.update(1)

click.echo(click.style("All files scanned and duplicates handled.", fg='green'))
Expand Down Expand Up @@ -60,7 +64,11 @@ def process_file(file_path):
futures = {executor.submit(process_file, file_path): file_path for file_path in all_files}

for future in as_completed(futures):
progress_bar.update(1)
try:
future.result() # Ensures exception handling for each future
except Exception as e:
click.echo(click.style(f"Error processing file {futures[future]}: {str(e)}", fg='red'))
progress_bar.update(1)

duplicates = []
for _, metadata in normalStore.items():
Expand All @@ -70,5 +78,3 @@ def process_file(file_path):
duplicates.append((original_path, duplicate_path))

return duplicates


0 comments on commit a3ec579

Please sign in to comment.