From 60e88efa943a73adfee256cb6fcf0a177427bd39 Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Sun, 1 Sep 2024 20:50:36 +0200 Subject: [PATCH] repository: catch store backend exception, re-raise as repo exception --- src/borg/repository.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/borg/repository.py b/src/borg/repository.py index 691c3f45a..23c3b1509 100644 --- a/src/borg/repository.py +++ b/src/borg/repository.py @@ -3,6 +3,7 @@ from borgstore.store import Store from borgstore.store import ObjectNotFound as StoreObjectNotFound +from borgstore.backends.errors import BackendDoesNotExist as StoreBackendDoesNotExist from .checksums import xxh64 from .constants import * # NOQA @@ -177,7 +178,10 @@ def destroy(self): def open(self, *, exclusive, lock_wait=None, lock=True): assert lock_wait is not None - self.store.open() + try: + self.store.open() + except StoreBackendDoesNotExist: + raise self.DoesNotExist(str(self._location)) from None if lock: self.lock = Lock(self.store, exclusive, timeout=lock_wait).acquire() else: