mirror of
https://github.com/borgbackup/borg.git
synced 2024-12-23 00:07:38 +00:00
Added missing repository path/url when raising DoesNotExist and AlreadyExists exceptions
This commit is contained in:
parent
87749e413e
commit
4e68f98dde
2 changed files with 7 additions and 5 deletions
|
@ -71,6 +71,7 @@ def __init__(self, name):
|
|||
self.name = name
|
||||
|
||||
def __init__(self, location, create=False):
|
||||
self.repository_url = '%s@%s:%s' % (location.user, location.host, location.path)
|
||||
self.p = None
|
||||
self.cache = LRUCache(256)
|
||||
self.to_send = b''
|
||||
|
@ -105,9 +106,9 @@ def __init__(self, location, create=False):
|
|||
self.id = self.call('open', (location.path, create))
|
||||
except self.RPCError as e:
|
||||
if e.name == b'DoesNotExist':
|
||||
raise Repository.DoesNotExist
|
||||
raise Repository.DoesNotExist(self.repository_url)
|
||||
elif e.name == b'AlreadyExists':
|
||||
raise Repository.AlreadyExists
|
||||
raise Repository.AlreadyExists(self.repository_url)
|
||||
|
||||
def __del__(self):
|
||||
self.close()
|
||||
|
@ -247,7 +248,7 @@ def get(self, id):
|
|||
return res
|
||||
except self.RPCError as e:
|
||||
if e.name == b'DoesNotExist':
|
||||
raise Repository.DoesNotExist
|
||||
raise Repository.DoesNotExist(self.repository_url)
|
||||
raise
|
||||
|
||||
def get_many(self, ids, peek=None):
|
||||
|
|
|
@ -41,6 +41,7 @@ class InvalidRepository(Error):
|
|||
|
||||
|
||||
def __init__(self, path, create=False):
|
||||
self.path = path
|
||||
self.io = None
|
||||
self.lock = None
|
||||
if create:
|
||||
|
@ -216,7 +217,7 @@ def get(self, id):
|
|||
segment, offset = self.index[id]
|
||||
return self.io.read(segment, offset, id)
|
||||
except KeyError:
|
||||
raise self.DoesNotExist
|
||||
raise self.DoesNotExist(self.path)
|
||||
|
||||
def get_many(self, ids, peek=None):
|
||||
for id in ids:
|
||||
|
@ -254,7 +255,7 @@ def delete(self, id, wait=True):
|
|||
self.compact.add(segment)
|
||||
self.segments.setdefault(segment, 0)
|
||||
except KeyError:
|
||||
raise self.DoesNotExist
|
||||
raise self.DoesNotExist(self.path)
|
||||
|
||||
def add_callback(self, cb, data):
|
||||
cb(None, None, data)
|
||||
|
|
Loading…
Reference in a new issue