1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2025-02-23 14:41:43 +00:00

prettier error message when archive gets too big, fixes #5307

This commit is contained in:
Thomas Waldmann 2020-09-08 21:00:27 +02:00
parent e70e49f47e
commit 0839ac3034

View file

@ -576,7 +576,15 @@ def save(self, name=None, comment=None, timestamp=None, stats=None, additional_m
metadata = ArchiveItem(metadata)
data = self.key.pack_and_authenticate_metadata(metadata.as_dict(), context=b'archive')
self.id = self.key.id_hash(data)
self.cache.add_chunk(self.id, data, self.stats)
try:
self.cache.add_chunk(self.id, data, self.stats)
except IntegrityError as err:
err_msg = str(err)
# hack to avoid changing the RPC protocol by introducing new (more specific) exception class
if 'More than allowed put data' in err_msg:
raise Error('%s - archive too big (issue #1473)!' % err_msg)
else:
raise
while self.repository.async_response(wait=True) is not None:
pass
self.manifest.archives[name] = (self.id, metadata.time)