1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2024-12-25 09:19:31 +00:00

raise OSError including the error message derived from errno

also: deal with path being a integer FD
This commit is contained in:
Thomas Waldmann 2016-08-11 20:11:36 +02:00
parent 67c6c1898c
commit 09dbec99a0

View file

@ -102,7 +102,13 @@ def _check(rv, path=None):
if e == errno.ERANGE:
raise BufferTooSmallError
else:
raise OSError(e, path)
try:
msg = os.strerror(e)
except ValueError:
msg = ''
if isinstance(path, int):
path = '<FD %d>' % path
raise OSError(e, msg, path)
return rv