refactor(backups): handle the case when there is no snapshot to sync date with

This commit is contained in:
Houkime 2024-09-01 21:27:01 +00:00
parent 53c6bc1af7
commit 1a9a381753

View file

@ -275,7 +275,13 @@ class Backups:
This is a convenience, maybe it is better to write a special comparison This is a convenience, maybe it is better to write a special comparison
function for snapshots function for snapshots
""" """
return Storage.get_cached_snapshot_by_id(snapshot.id)
snap = Storage.get_cached_snapshot_by_id(snapshot.id)
if snap is None:
raise ValueError(
f"snapshot {snapshot.id} date syncing failed, this should never happen normally"
)
return snap
@staticmethod @staticmethod
def _auto_snaps(service) -> List[Snapshot]: def _auto_snaps(service) -> List[Snapshot]: