From 5e07a9eaebd080ef07cdb8ac1dcea5820f4e52a8 Mon Sep 17 00:00:00 2001 From: Houkime <> Date: Fri, 26 Jul 2024 10:12:51 +0000 Subject: [PATCH] feature(backup): error handling for the full restore endpoint --- .../graphql/mutations/backup_mutations.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/selfprivacy_api/graphql/mutations/backup_mutations.py b/selfprivacy_api/graphql/mutations/backup_mutations.py index 522cecf..2521303 100644 --- a/selfprivacy_api/graphql/mutations/backup_mutations.py +++ b/selfprivacy_api/graphql/mutations/backup_mutations.py @@ -24,6 +24,7 @@ from selfprivacy_api.backup.tasks import ( start_backup, restore_snapshot, prune_autobackup_snapshots, + full_restore, ) from selfprivacy_api.backup.jobs import ( add_backup_job, @@ -176,7 +177,16 @@ class BackupMutations: This happens in sync with partial merging of old configuration for compatibility """ - job = add_total_restore_job() + try: + job = add_total_restore_job() + full_restore(job) + except Exception as error: + return GenericJobMutationReturn( + success=False, + code=400, + message=str(error), + job=None, + ) return GenericJobMutationReturn( success=True,