error.mjs 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. import CustomError from 'custom-error-instance'
  2. export default {
  3. Custom (slug, message) {
  4. return CustomError(slug, { message })
  5. },
  6. AssetDeleteForbidden: CustomError('AssetDeleteForbidden', {
  7. message: 'You are not authorized to delete this asset.'
  8. }),
  9. AssetFolderExists: CustomError('AssetFolderExists', {
  10. message: 'An asset folder with the same name already exists.'
  11. }),
  12. AssetGenericError: CustomError('AssetGenericError', {
  13. message: 'An unexpected error occured during asset operation.'
  14. }),
  15. AssetInvalid: CustomError('AssetInvalid', {
  16. message: 'This asset does not exist or is invalid.'
  17. }),
  18. AssetRenameCollision: CustomError('AssetRenameCollision', {
  19. message: 'An asset with the same filename in the same folder already exists.'
  20. }),
  21. AssetRenameForbidden: CustomError('AssetRenameForbidden', {
  22. message: 'You are not authorized to rename this asset.'
  23. }),
  24. AssetRenameInvalid: CustomError('AssetRenameInvalid', {
  25. message: 'The new asset filename is invalid.'
  26. }),
  27. AssetRenameInvalidExt: CustomError('AssetRenameInvalidExt', {
  28. message: 'The file extension cannot be changed on an existing asset.'
  29. }),
  30. AssetRenameTargetForbidden: CustomError('AssetRenameTargetForbidden', {
  31. message: 'You are not authorized to rename this asset to the requested name.'
  32. }),
  33. AuthAccountBanned: CustomError('AuthAccountBanned', {
  34. message: 'Your account has been disabled.'
  35. }),
  36. AuthAccountAlreadyExists: CustomError('AuthAccountAlreadyExists', {
  37. message: 'An account already exists using this email address.'
  38. }),
  39. AuthAccountNotVerified: CustomError('AuthAccountNotVerified', {
  40. message: 'You must verify your account before your can login.'
  41. }),
  42. AuthGenericError: CustomError('AuthGenericError', {
  43. message: 'An unexpected error occured during login.'
  44. }),
  45. AuthLoginFailed: CustomError('AuthLoginFailed', {
  46. message: 'Invalid email / username or password.'
  47. }),
  48. AuthPasswordInvalid: CustomError('AuthPasswordInvalid', {
  49. message: 'Password is incorrect.'
  50. }),
  51. AuthProviderInvalid: CustomError('AuthProviderInvalid', {
  52. message: 'Invalid authentication provider.'
  53. }),
  54. AuthRegistrationDisabled: CustomError('AuthRegistrationDisabled', {
  55. message: 'Registration is disabled. Contact your system administrator.'
  56. }),
  57. AuthRegistrationDomainUnauthorized: CustomError('AuthRegistrationDomainUnauthorized', {
  58. message: 'You are not authorized to register. Your domain is not whitelisted.'
  59. }),
  60. AuthRequired: CustomError('AuthRequired', {
  61. message: 'You must be authenticated to access this resource.'
  62. }),
  63. AuthTFAFailed: CustomError('AuthTFAFailed', {
  64. message: 'Incorrect TFA Security Code.'
  65. }),
  66. AuthTFAInvalid: CustomError('AuthTFAInvalid', {
  67. message: 'Invalid TFA Security Code or Login Token.'
  68. }),
  69. AuthValidationTokenInvalid: CustomError('AuthValidationTokenInvalid', {
  70. message: 'Invalid validation token.'
  71. }),
  72. BruteInstanceIsInvalid: CustomError('BruteInstanceIsInvalid', {
  73. message: 'Invalid Brute Force Instance.'
  74. }),
  75. BruteTooManyAttempts: CustomError('BruteTooManyAttempts', {
  76. message: 'Too many attempts! Try again later.'
  77. }),
  78. CommentContentMissing: CustomError('CommentContentMissing', {
  79. message: 'Comment content is missing or too short.'
  80. }),
  81. CommentGenericError: CustomError('CommentGenericError', {
  82. message: 'An unexpected error occured.'
  83. }),
  84. CommentManageForbidden: CustomError('CommentManageForbidden', {
  85. message: 'You are not authorized to manage comments on this page.'
  86. }),
  87. CommentNotFound: CustomError('CommentNotFound', {
  88. message: 'This comment does not exist.'
  89. }),
  90. CommentPostForbidden: CustomError('CommentPostForbidden', {
  91. message: 'You are not authorized to post a comment on this page.'
  92. }),
  93. CommentViewForbidden: CustomError('CommentViewForbidden', {
  94. message: 'You are not authorized to view comments for this page.'
  95. }),
  96. InputInvalid: CustomError('InputInvalid', {
  97. message: 'Input data is invalid.'
  98. }),
  99. LocaleGenericError: CustomError('LocaleGenericError', {
  100. message: 'An unexpected error occured during locale operation.'
  101. }),
  102. LocaleInvalidNamespace: CustomError('LocaleInvalidNamespace', {
  103. message: 'Invalid locale or namespace.'
  104. }),
  105. MailGenericError: CustomError('MailGenericError', {
  106. message: 'An unexpected error occured during mail operation.'
  107. }),
  108. MailInvalidRecipient: CustomError('MailInvalidRecipient', {
  109. message: 'The recipient email address is invalid.'
  110. }),
  111. MailNotConfigured: CustomError('MailNotConfigured', {
  112. message: 'The mail configuration is incomplete or invalid.'
  113. }),
  114. MailTemplateFailed: CustomError('MailTemplateFailed', {
  115. message: 'Mail template failed to load.'
  116. }),
  117. PageCreateForbidden: CustomError('PageCreateForbidden', {
  118. message: 'You are not authorized to create this page.'
  119. }),
  120. PageDeleteForbidden: CustomError('PageDeleteForbidden', {
  121. message: 'You are not authorized to delete this page.'
  122. }),
  123. PageGenericError: CustomError('PageGenericError', {
  124. message: 'An unexpected error occured during a page operation.'
  125. }),
  126. PageDuplicateCreate: CustomError('PageDuplicateCreate', {
  127. message: 'Cannot create this page because an entry already exists at the same path.'
  128. }),
  129. PageEmptyContent: CustomError('PageEmptyContent', {
  130. message: 'Page content cannot be empty.'
  131. }),
  132. PageHistoryForbidden: CustomError('PageHistoryForbidden', {
  133. message: 'You are not authorized to view the history of this page.'
  134. }),
  135. PageIllegalPath: CustomError('PageIllegalPath', {
  136. message: 'Page path cannot contains illegal characters.'
  137. }),
  138. PageMoveForbidden: CustomError('PageMoveForbidden', {
  139. message: 'You are not authorized to move this page.'
  140. }),
  141. PageNotFound: CustomError('PageNotFound', {
  142. message: 'This page does not exist.'
  143. }),
  144. PagePathCollision: CustomError('PagePathCollision', {
  145. message: 'Destination page path already exists.'
  146. }),
  147. PageRestoreForbidden: CustomError('PageRestoreForbidden', {
  148. message: 'You are not authorized to restore this page version.'
  149. }),
  150. PageUpdateForbidden: CustomError('PageUpdateForbidden', {
  151. message: 'You are not authorized to update this page.'
  152. }),
  153. PageViewForbidden: CustomError('PageViewForbidden', {
  154. message: 'You are not authorized to view this page.'
  155. }),
  156. SearchActivationFailed: CustomError('SearchActivationFailed', {
  157. message: 'Search Engine activation failed.'
  158. }),
  159. SearchGenericError: CustomError('SearchGenericError', {
  160. message: 'An unexpected error occured during search operation.'
  161. }),
  162. SystemGenericError: CustomError('SystemGenericError', {
  163. message: 'An unexpected error occured.'
  164. }),
  165. SystemSSLDisabled: CustomError('SystemSSLDisabled', {
  166. message: 'SSL is not enabled.'
  167. }),
  168. SystemSSLLEUnavailable: CustomError('SystemSSLLEUnavailable', {
  169. message: 'Let\'s Encrypt is not initialized.'
  170. }),
  171. SystemSSLRenewInvalidProvider: CustomError('SystemSSLRenewInvalidProvider', {
  172. message: 'Current provider does not support SSL certificate renewal.'
  173. }),
  174. UserCreationFailed: CustomError('UserCreationFailed', {
  175. message: 'An unexpected error occured during user creation.'
  176. }),
  177. UserDeleteForeignConstraint: CustomError('UserDeleteForeignConstraint', {
  178. message: 'Cannot delete user because of content relational constraints.'
  179. }),
  180. UserDeleteProtected: CustomError('UserDeleteProtected', {
  181. message: 'Cannot delete a protected system account.'
  182. }),
  183. UserNotFound: CustomError('UserNotFound', {
  184. message: 'This user does not exist.'
  185. })
  186. }