mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy-rest-api.git
synced 2025-01-25 18:26:34 +00:00
feature(backup): error handling for the full restore endpoint
This commit is contained in:
parent
7de5d26a81
commit
5e07a9eaeb
|
@ -24,6 +24,7 @@ from selfprivacy_api.backup.tasks import (
|
||||||
start_backup,
|
start_backup,
|
||||||
restore_snapshot,
|
restore_snapshot,
|
||||||
prune_autobackup_snapshots,
|
prune_autobackup_snapshots,
|
||||||
|
full_restore,
|
||||||
)
|
)
|
||||||
from selfprivacy_api.backup.jobs import (
|
from selfprivacy_api.backup.jobs import (
|
||||||
add_backup_job,
|
add_backup_job,
|
||||||
|
@ -176,7 +177,16 @@ class BackupMutations:
|
||||||
This happens in sync with partial merging of old configuration for compatibility
|
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(
|
return GenericJobMutationReturn(
|
||||||
success=True,
|
success=True,
|
||||||
|
|
Loading…
Reference in a new issue