Pārlūkot izejas kodu

add NotFoundWarning

Thomas Waldmann 1 gadu atpakaļ
vecāks
revīzija
82f147f63f
2 mainītis faili ar 9 papildinājumiem un 0 dzēšanām
  1. 2 0
      docs/internals/frontends.rst
  2. 7 0
      src/borg/helpers/errors.py

+ 2 - 0
docs/internals/frontends.rst

@@ -703,6 +703,8 @@ Warnings
         {}: {}
         {}: {}
     IOWarning rc: 106
     IOWarning rc: 106
         {}: {}
         {}: {}
+    NotFoundWarning rc: 107
+        {}: {}
 
 
 Operations
 Operations
     - cache.begin_transaction
     - cache.begin_transaction

+ 7 - 0
src/borg/helpers/errors.py

@@ -117,6 +117,8 @@ class BackupOSWarning(BorgWarning):
         assert isinstance(exc, BackupOSError)
         assert isinstance(exc, BackupOSError)
         if exc.errno in (errno.EPERM, errno.EACCES, ):
         if exc.errno in (errno.EPERM, errno.EACCES, ):
             return PermissionWarning.exit_mcode
             return PermissionWarning.exit_mcode
+        elif exc.errno in (errno.ENOENT, ):
+            return NotFoundWarning.exit_mcode
         elif exc.errno in (errno.EIO, ):
         elif exc.errno in (errno.EIO, ):
             return IOWarning.exit_mcode
             return IOWarning.exit_mcode
         else:
         else:
@@ -133,6 +135,11 @@ class IOWarning(BorgWarning):
     exit_mcode = 106
     exit_mcode = 106
 
 
 
 
+class NotFoundWarning(BorgWarning):
+    """{}: {}"""
+    exit_mcode = 107
+
+
 class BackupError(Exception):
 class BackupError(Exception):
     """
     """
     Exception raised for non-OSError-based exceptions while accessing backup files.
     Exception raised for non-OSError-based exceptions while accessing backup files.