From e186813a4951d02004b9a7eaa34add183352e858 Mon Sep 17 00:00:00 2001 From: Moritz Date: Wed, 25 Oct 2023 13:37:06 +0200 Subject: [PATCH] better error handling --- backupbot.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/backupbot.py b/backupbot.py index 7d48b9e..873ae05 100755 --- a/backupbot.py +++ b/backupbot.py @@ -150,9 +150,14 @@ def run_commands(commands): def backup_volumes(backup_paths, apps, dry_run=False): - result = restic.backup(backup_paths, dry_run=dry_run, tags=apps) - print(result) - logging.info(result) + try: + result = restic.backup(backup_paths, dry_run=dry_run, tags=apps) + print(result) + logging.info(result) + except ResticFailedError as error: + logging.error(f"Backup failed for {apps}. Could not Backup these paths: {backup_paths}") + logging.error(error) + exit(1) @cli.command()