diff --git a/docs/internals/frontends.rst b/docs/internals/frontends.rst index b054331a..2003bad3 100644 --- a/docs/internals/frontends.rst +++ b/docs/internals/frontends.rst @@ -721,6 +721,8 @@ Warnings {}: {} IOWarning rc: 106 {}: {} + NotFoundWarning rc: 107 + {}: {} Operations - cache.begin_transaction diff --git a/src/borg/helpers/errors.py b/src/borg/helpers/errors.py index 10012ef4..b40005d9 100644 --- a/src/borg/helpers/errors.py +++ b/src/borg/helpers/errors.py @@ -128,6 +128,8 @@ class BackupOSWarning(BorgWarning): assert isinstance(exc, BackupOSError) if exc.errno in (errno.EPERM, errno.EACCES): return PermissionWarning.exit_mcode + elif exc.errno in (errno.ENOENT,): + return NotFoundWarning.exit_mcode elif exc.errno in (errno.EIO,): return IOWarning.exit_mcode else: @@ -146,6 +148,12 @@ class IOWarning(BorgWarning): exit_mcode = 106 +class NotFoundWarning(BorgWarning): + """{}: {}""" + + exit_mcode = 107 + + class BackupError(Exception): """ Exception raised for non-OSError-based exceptions while accessing backup files.