Skip to content
Merged
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions anonyfiles_cli/commands/anonymize.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ def process_anonymize(
console.handle_error(e, "anonymize_command_validation_or_setup")
raise typer.Exit(code=ExitCodes.CONFIG_ERROR) # ou l'exit code approprié à l'erreur

except typer.Exit:
raise

except Exception as e:
console.handle_error(e, "anonymize_command_unexpected")
raise typer.Exit(code=ExitCodes.GENERAL_ERROR)
3 changes: 3 additions & 0 deletions anonyfiles_cli/commands/batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ def process_batch(
console.handle_error(e, "batch_command_setup")
raise typer.Exit(code=e.exit_code) # Utilise l'exit_code défini dans AnonyfilesError

except typer.Exit:
raise

except Exception as e:
console.handle_error(e, "batch_command_unexpected")
raise typer.Exit(code=ExitCodes.GENERAL_ERROR)
4 changes: 4 additions & 0 deletions anonyfiles_cli/commands/clean_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ def delete_job(
except AnonyfilesError as e:
console.handle_error(e, "delete_job_command")
raise typer.Exit(e.exit_code)
except typer.Exit:
raise
except Exception as e:
console.handle_error(e, "delete_job_command_unexpected")
raise typer.Exit(1)
Expand Down Expand Up @@ -107,6 +109,8 @@ def list_jobs(
except AnonyfilesError as e:
console.handle_error(e, "list_jobs_command")
raise typer.Exit(e.exit_code)
except typer.Exit:
raise
except Exception as e:
console.handle_error(e, "list_jobs_command_unexpected")
raise typer.Exit(1)
17 changes: 17 additions & 0 deletions anonyfiles_cli/commands/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ def show_config(
console.console.print(f"\n[dim]Fichier de configuration utilisateur : {user_config_path}[/dim]")
else:
console.console.print(f"\n[dim]Aucun fichier de configuration utilisateur trouvé. La configuration par défaut est utilisée.[/dim]")
except typer.Exit:
raise

except Exception as e:
console.handle_error(e, "config_show_command")
raise typer.Exit(ExitCodes.GENERAL_ERROR)
Expand All @@ -64,6 +67,9 @@ def create_config(
try:
ConfigManager.create_default_user_config()
console.console.print(f"✅ Configuration par défaut créée dans : [green]{user_config_path}[/green]")
except typer.Exit:
raise

except Exception as e:
console.handle_error(e, "config_create_command")
raise typer.Exit(ExitCodes.CONFIG_ERROR)
Expand All @@ -87,6 +93,9 @@ def reset_config(
os.remove(user_config_path)
ConfigManager.create_default_user_config() # Recrée une version par défaut
console.console.print("✅ Configuration utilisateur réinitialisée.")
except typer.Exit:
raise

except Exception as e:
console.handle_error(e, "config_reset_command")
raise typer.Exit(ExitCodes.CONFIG_ERROR)
Expand All @@ -98,6 +107,9 @@ def reset_config(
try:
ConfigManager.create_default_user_config()
console.console.print(f"✅ Configuration par défaut créée dans : [green]{user_config_path}[/green]")
except typer.Exit:
raise

except Exception as e:
console.handle_error(e, "config_reset_command")
raise typer.Exit(ExitCodes.CONFIG_ERROR)
Expand All @@ -111,6 +123,9 @@ def edit_config():
try:
ConfigManager.create_default_user_config()
console.console.print(f"✅ Fichier de configuration par défaut créé : [green]{user_config_path}[/green]", style="green")
except typer.Exit:
raise

except Exception as e:
console.handle_error(e, "config_edit_command")
raise typer.Exit(ExitCodes.CONFIG_ERROR)
Expand All @@ -130,6 +145,8 @@ def validate_config_cmd(
except ConfigurationError as e:
console.console.print(f"❌ {e}", style="red")
raise typer.Exit(ExitCodes.CONFIG_ERROR)
except typer.Exit:
raise
except Exception as e:
console.handle_error(e, "config_validate_command")
raise typer.Exit(ExitCodes.GENERAL_ERROR)
3 changes: 3 additions & 0 deletions anonyfiles_cli/commands/deanonymize.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ def process_deanonymize(
console.handle_error(e, "deanonymize_command_validation_or_setup")
raise typer.Exit(code=ExitCodes.CONFIG_ERROR)

except typer.Exit:
raise

except Exception as e:
console.handle_error(e, "deanonymize_command_unexpected")
raise typer.Exit(code=ExitCodes.GENERAL_ERROR)
4 changes: 4 additions & 0 deletions anonyfiles_cli/commands/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ def file_info(
except Exception as e:
console.console.print(f"❌ Erreur de lecture du contenu : {e}", style="red")

except typer.Exit:
raise
except Exception as e:
console.handle_error(e, "file_info_command")
raise typer.Exit(code=ExitCodes.GENERAL_ERROR)
Expand Down Expand Up @@ -142,6 +144,8 @@ def run_benchmark(
else:
console.console.print(f" ❌ Erreur pendant l'itération, temps mesuré : {duration:.2f}s", style="red")

except typer.Exit:
raise
except Exception as e:
console.console.print(f" ❌ Erreur inattendue lors du benchmark : [red]{e}[/red]", style="red")

Expand Down
Loading