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:
parent
67c6c1898c
commit
09dbec99a0
1 changed files with 7 additions and 1 deletions
|
@ -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
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue