Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved Error Handling #62

Merged
merged 1 commit into from
Oct 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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


Loading