mirror of
https://github.com/borgbackup/borg.git
synced 2025-02-02 04:24:34 +00:00
more detailled warnings for source file OSErrors
This commit is contained in:
parent
53291a4ac0
commit
2fda86ce61
1 changed files with 22 additions and 0 deletions
|
@ -1,3 +1,4 @@
|
|||
import errno
|
||||
import os
|
||||
|
||||
from ..constants import * # NOQA
|
||||
|
@ -108,6 +109,27 @@ class BackupOSWarning(BorgWarning):
|
|||
"""{}: {}"""
|
||||
exit_mcode = 104
|
||||
|
||||
@property
|
||||
def exit_code(self):
|
||||
if not modern_ec:
|
||||
return EXIT_WARNING
|
||||
exc = self.args[1]
|
||||
assert isinstance(exc, BackupOSError)
|
||||
if exc.errno in (errno.EPERM, errno.EACCES, ):
|
||||
return PermissionWarning.exit_mcode
|
||||
elif exc.errno in (errno.EIO, ):
|
||||
return IOWarning.exit_mcode
|
||||
else:
|
||||
return self.exit_mcode
|
||||
|
||||
|
||||
class PermissionWarning(BorgWarning):
|
||||
exit_mcode = 105
|
||||
|
||||
|
||||
class IOWarning(BorgWarning):
|
||||
exit_mcode = 106
|
||||
|
||||
|
||||
class BackupError(Exception):
|
||||
"""
|
||||
|
|
Loading…
Reference in a new issue