mirror of
https://github.com/borgbackup/borg.git
synced 2026-06-11 09:59:19 -04:00
fix some exception handlers
don't catch "Exception" when OSError was meant (otherwise e.errno is not there anyway) don't use bare "except:" if one can avoid (copied code fragment from similar handler)
This commit is contained in:
parent
4ab4ecc7af
commit
2da70c7d7a
2 changed files with 4 additions and 2 deletions
|
|
@ -587,7 +587,9 @@ class ArchiveChecker:
|
|||
continue
|
||||
try:
|
||||
archive = msgpack.unpackb(data)
|
||||
except:
|
||||
# Ignore exceptions that might be raised when feeding
|
||||
# msgpack with invalid data
|
||||
except (TypeError, ValueError, StopIteration):
|
||||
continue
|
||||
if isinstance(archive, dict) and b'items' in archive and b'cmdline' in archive:
|
||||
self.report_progress('Found archive ' + archive[b'name'].decode('utf-8'), error=True)
|
||||
|
|
|
|||
|
|
@ -446,7 +446,7 @@ class LoggedIO(object):
|
|||
with open(filename, 'rb') as fd:
|
||||
try:
|
||||
fd.seek(-self.header_fmt.size, os.SEEK_END)
|
||||
except Exception as e:
|
||||
except OSError as e:
|
||||
# return False if segment file is empty or too small
|
||||
if e.errno == errno.EINVAL:
|
||||
return False
|
||||
|
|
|
|||
Loading…
Reference in a new issue