1
0

errors.go 4.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. package backup
  2. import (
  3. "github.com/uozi-tech/cosy"
  4. )
  5. var (
  6. e = cosy.NewErrorScope("backup")
  7. ErrCreateTempDir = e.New(4002, "Failed to create temporary directory")
  8. ErrCreateTempSubDir = e.New(4003, "Failed to create temporary subdirectory")
  9. ErrBackupNginxUI = e.New(4004, "Failed to backup Nginx UI files: {0}")
  10. ErrBackupNginx = e.New(4005, "Failed to backup Nginx config files: {0}")
  11. ErrCreateHashFile = e.New(4006, "Failed to create hash info file: {0}")
  12. ErrEncryptNginxUIDir = e.New(4007, "Failed to encrypt Nginx UI directory: {0}")
  13. ErrEncryptNginxDir = e.New(4008, "Failed to encrypt Nginx directory: {0}")
  14. ErrCreateZipArchive = e.New(4009, "Failed to create zip archive: {0}")
  15. ErrGenerateAESKey = e.New(4011, "Failed to generate AES key: {0}")
  16. ErrGenerateIV = e.New(4012, "Failed to generate initialization vector: {0}")
  17. ErrCreateBackupFile = e.New(4013, "Failed to create backup file: {0}")
  18. ErrCleanupTempDir = e.New(4014, "Failed to cleanup temporary directory: {0}")
  19. ErrConfigPathEmpty = e.New(4101, "Config path is empty")
  20. ErrCopyConfigFile = e.New(4102, "Failed to copy config file: {0}")
  21. ErrCopyDBFile = e.New(4104, "Failed to copy database file: {0}")
  22. ErrCalculateHash = e.New(4105, "Failed to calculate hash: {0}")
  23. ErrNginxConfigDirEmpty = e.New(4106, "Nginx config directory is not set")
  24. ErrCopyNginxConfigDir = e.New(4107, "Failed to copy Nginx config directory: {0}")
  25. ErrReadSymlink = e.New(4108, "Failed to read symlink: {0}")
  26. ErrReadFile = e.New(4201, "Failed to read file: {0}")
  27. ErrEncryptFile = e.New(4202, "Failed to encrypt file: {0}")
  28. ErrWriteEncryptedFile = e.New(4203, "Failed to write encrypted file: {0}")
  29. ErrEncryptData = e.New(4204, "Failed to encrypt data: {0}")
  30. ErrDecryptData = e.New(4205, "Failed to decrypt data: {0}")
  31. ErrInvalidPadding = e.New(4206, "Invalid padding in decrypted data")
  32. ErrCreateZipFile = e.New(4301, "Failed to create zip file: {0}")
  33. ErrCreateZipEntry = e.New(4302, "Failed to create zip entry: {0}")
  34. ErrOpenSourceFile = e.New(4303, "Failed to open source file: {0}")
  35. ErrCreateZipHeader = e.New(4304, "Failed to create zip header: {0}")
  36. ErrCopyContent = e.New(4305, "Failed to copy file content: {0}")
  37. ErrCreateRestoreDir = e.New(4501, "Failed to create restore directory: {0}")
  38. ErrExtractArchive = e.New(4505, "Failed to extract archive: {0}")
  39. ErrDecryptNginxUIDir = e.New(4506, "Failed to decrypt Nginx UI directory: {0}")
  40. ErrDecryptNginxDir = e.New(4507, "Failed to decrypt Nginx directory: {0}")
  41. ErrVerifyHashes = e.New(4508, "Failed to verify hashes: {0}")
  42. ErrRestoreNginxConfigs = e.New(4509, "Failed to restore Nginx configs: {0}")
  43. ErrBackupFileNotFound = e.New(4511, "Backup file not found: {0}")
  44. ErrInvalidSecurityToken = e.New(4512, "Invalid security token format")
  45. ErrInvalidAESKey = e.New(4513, "Invalid AES key format: {0}")
  46. ErrInvalidAESIV = e.New(4514, "Invalid AES IV format: {0}")
  47. ErrOpenZipFile = e.New(4601, "Failed to open zip file: {0}")
  48. ErrCreateDir = e.New(4602, "Failed to create directory: {0}")
  49. ErrCreateParentDir = e.New(4603, "Failed to create parent directory: {0}")
  50. ErrCreateFile = e.New(4604, "Failed to create file: {0}")
  51. ErrOpenZipEntry = e.New(4605, "Failed to open zip entry: {0}")
  52. ErrCreateSymlink = e.New(4606, "Failed to create symbolic link: {0}")
  53. ErrInvalidFilePath = e.New(4607, "Invalid file path: {0}")
  54. ErrReadEncryptedFile = e.New(4701, "Failed to read encrypted file: {0}")
  55. ErrDecryptFile = e.New(4702, "Failed to decrypt file: {0}")
  56. ErrWriteDecryptedFile = e.New(4703, "Failed to write decrypted file: {0}")
  57. ErrReadHashFile = e.New(4801, "Failed to read hash info file: {0}")
  58. ErrCalculateUIHash = e.New(4802, "Failed to calculate Nginx UI hash: {0}")
  59. ErrCalculateNginxHash = e.New(4803, "Failed to calculate Nginx hash: {0}")
  60. ErrAutoBackupPathRequired = e.New(4903, "Backup path is required for custom directory backup")
  61. ErrAutoBackupS3ConfigIncomplete = e.New(4904, "S3 configuration is incomplete: missing {0}")
  62. ErrAutoBackupUnsupportedType = e.New(4905, "Unsupported backup type: {0}")
  63. ErrAutoBackupWriteFile = e.New(4907, "Failed to write backup file: {0}")
  64. ErrAutoBackupWriteKeyFile = e.New(4908, "Failed to write security key file: {0}")
  65. ErrAutoBackupS3Upload = e.New(4909, "S3 upload failed: {0}")
  66. ErrInvalidPath = e.New(4910, "Invalid path: {0}")
  67. ErrPathNotInGrantedAccess = e.New(4911, "Path not in granted access paths: {0}")
  68. ErrBackupPathNotExist = e.New(4912, "Backup path does not exist: {0}")
  69. ErrBackupPathAccess = e.New(4913, "Cannot access backup path {0}: {1}")
  70. ErrBackupPathNotDirectory = e.New(4914, "Backup path is not a directory: {0}")
  71. ErrCreateStorageDir = e.New(4915, "Failed to create storage directory {0}: {1}")
  72. ErrStoragePathAccess = e.New(4916, "Cannot access storage path {0}: {1}")
  73. )