瀏覽代碼

add NotFoundWarning

Thomas Waldmann 1 年之前
父節點
當前提交
82f147f63f
共有 2 個文件被更改,包括 9 次插入0 次删除
  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
         {}: {}
+    NotFoundWarning rc: 107
+        {}: {}
 
 Operations
     - cache.begin_transaction

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

@@ -117,6 +117,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:
@@ -133,6 +135,11 @@ 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.