error.js 8.3 KB
Newer Older
1
const CustomError = require('custom-error-instance')
2 3

module.exports = {
Nick's avatar
Nick committed
4 5 6 7
  AssetDeleteForbidden: CustomError('AssetDeleteForbidden', {
    message: 'You are not authorized to delete this asset.',
    code: 2003
  }),
Nick's avatar
Nick committed
8 9
  AssetFolderExists: CustomError('AssetFolderExists', {
    message: 'An asset folder with the same name already exists.',
Nick's avatar
Nick committed
10 11 12
    code: 2002
  }),
  AssetGenericError: CustomError('AssetGenericError', {
13
    message: 'An unexpected error occured during asset operation.',
Nick's avatar
Nick committed
14 15
    code: 2001
  }),
Nick's avatar
Nick committed
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
  AssetInvalid: CustomError('AssetInvalid', {
    message: 'This asset does not exist or is invalid.',
    code: 2004
  }),
  AssetRenameCollision: CustomError('AssetRenameCollision', {
    message: 'An asset with the same filename in the same folder already exists.',
    code: 2005
  }),
  AssetRenameForbidden: CustomError('AssetRenameForbidden', {
    message: 'You are not authorized to rename this asset.',
    code: 2006
  }),
  AssetRenameInvalid: CustomError('AssetRenameInvalid', {
    message: 'The new asset filename is invalid.',
    code: 2007
  }),
  AssetRenameInvalidExt: CustomError('AssetRenameInvalidExt', {
    message: 'The file extension cannot be changed on an existing asset.',
    code: 2008
  }),
  AssetRenameTargetForbidden: CustomError('AssetRenameTargetForbidden', {
    message: 'You are not authorized to rename this asset to the requested name.',
    code: 2009
  }),
40 41
  AuthAccountBanned: CustomError('AuthAccountBanned', {
    message: 'Your account has been disabled.',
42 43 44 45 46
    code: 1013
  }),
  AuthAccountAlreadyExists: CustomError('AuthAccountAlreadyExists', {
    message: 'An account already exists using this email address.',
    code: 1004
47 48 49
  }),
  AuthAccountNotVerified: CustomError('AuthAccountNotVerified', {
    message: 'You must verify your account before your can login.',
50
    code: 1014
51
  }),
52 53 54 55 56 57 58 59
  AuthGenericError: CustomError('AuthGenericError', {
    message: 'An unexpected error occured during login.',
    code: 1001
  }),
  AuthLoginFailed: CustomError('AuthLoginFailed', {
    message: 'Invalid email / username or password.',
    code: 1002
  }),
60 61 62 63
  AuthPasswordInvalid: CustomError('AuthPasswordInvalid', {
    message: 'Password is incorrect.',
    code: 1020
  }),
64 65 66 67
  AuthProviderInvalid: CustomError('AuthProviderInvalid', {
    message: 'Invalid authentication provider.',
    code: 1003
  }),
68 69
  AuthRegistrationDisabled: CustomError('AuthRegistrationDisabled', {
    message: 'Registration is disabled. Contact your system administrator.',
70
    code: 1010
71 72
  }),
  AuthRegistrationDomainUnauthorized: CustomError('AuthRegistrationDomainUnauthorized', {
73 74
    message: 'You are not authorized to register. Your domain is not whitelisted.',
    code: 1011
75
  }),
76 77 78 79
  AuthRequired: CustomError('AuthRequired', {
    message: 'You must be authenticated to access this resource.',
    code: 1019
  }),
80 81 82 83 84 85 86 87
  AuthTFAFailed: CustomError('AuthTFAFailed', {
    message: 'Incorrect TFA Security Code.',
    code: 1005
  }),
  AuthTFAInvalid: CustomError('AuthTFAInvalid', {
    message: 'Invalid TFA Security Code or Login Token.',
    code: 1006
  }),
88 89
  AuthValidationTokenInvalid: CustomError('AuthValidationTokenInvalid', {
    message: 'Invalid validation token.',
90
    code: 1015
91
  }),
92 93 94 95 96 97 98 99
  BruteInstanceIsInvalid: CustomError('BruteInstanceIsInvalid', {
    message: 'Invalid Brute Force Instance.',
    code: 1007
  }),
  BruteTooManyAttempts: CustomError('BruteTooManyAttempts', {
    message: 'Too many attempts! Try again later.',
    code: 1008
  }),
100 101 102 103
  CommentContentMissing: CustomError('CommentContentMissing', {
    message: 'Comment content is missing or too short.',
    code: 8003
  }),
NGPixel's avatar
NGPixel committed
104 105 106 107
  CommentGenericError: CustomError('CommentGenericError', {
    message: 'An unexpected error occured.',
    code: 8001
  }),
108 109 110 111 112 113 114 115
  CommentManageForbidden: CustomError('CommentManageForbidden', {
    message: 'You are not authorized to manage comments on this page.',
    code: 8004
  }),
  CommentNotFound: CustomError('CommentNotFound', {
    message: 'This comment does not exist.',
    code: 8005
  }),
NGPixel's avatar
NGPixel committed
116 117 118 119 120 121 122 123
  CommentPostForbidden: CustomError('CommentPostForbidden', {
    message: 'You are not authorized to post a comment on this page.',
    code: 8002
  }),
  CommentViewForbidden: CustomError('CommentViewForbidden', {
    message: 'You are not authorized to view comments for this page.',
    code: 8006
  }),
124 125
  InputInvalid: CustomError('InputInvalid', {
    message: 'Input data is invalid.',
126
    code: 1012
127
  }),
128 129 130
  LocaleGenericError: CustomError('LocaleGenericError', {
    message: 'An unexpected error occured during locale operation.',
    code: 5001
131
  }),
132 133
  LocaleInvalidNamespace: CustomError('LocaleInvalidNamespace', {
    message: 'Invalid locale or namespace.',
134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150
    code: 5002
  }),
  MailGenericError: CustomError('MailGenericError', {
    message: 'An unexpected error occured during mail operation.',
    code: 3001
  }),
  MailInvalidRecipient: CustomError('MailInvalidRecipient', {
    message: 'The recipient email address is invalid.',
    code: 3004
  }),
  MailNotConfigured: CustomError('MailNotConfigured', {
    message: 'The mail configuration is incomplete or invalid.',
    code: 3002
  }),
  MailTemplateFailed: CustomError('MailTemplateFailed', {
    message: 'Mail template failed to load.',
    code: 3003
151
  }),
NGPixel's avatar
NGPixel committed
152 153 154 155 156 157 158 159
  PageCreateForbidden: CustomError('PageCreateForbidden', {
    message: 'You are not authorized to create this page.',
    code: 6008
  }),
  PageDeleteForbidden: CustomError('PageDeleteForbidden', {
    message: 'You are not authorized to delete this page.',
    code: 6010
  }),
Nick's avatar
Nick committed
160 161 162 163 164 165 166 167
  PageGenericError: CustomError('PageGenericError', {
    message: 'An unexpected error occured during a page operation.',
    code: 6001
  }),
  PageDuplicateCreate: CustomError('PageDuplicateCreate', {
    message: 'Cannot create this page because an entry already exists at the same path.',
    code: 6002
  }),
Nick's avatar
Nick committed
168 169 170 171
  PageEmptyContent: CustomError('PageEmptyContent', {
    message: 'Page content cannot be empty.',
    code: 6004
  }),
172 173 174 175
  PageHistoryForbidden: CustomError('PageHistoryForbidden', {
    message: 'You are not authorized to view the history of this page.',
    code: 6012
  }),
176 177 178 179
  PageIllegalPath: CustomError('PageIllegalPath', {
    message: 'Page path cannot contains illegal characters.',
    code: 6005
  }),
NGPixel's avatar
NGPixel committed
180 181 182 183
  PageMoveForbidden: CustomError('PageMoveForbidden', {
    message: 'You are not authorized to move this page.',
    code: 6007
  }),
184 185 186 187
  PageNotFound: CustomError('PageNotFound', {
    message: 'This page does not exist.',
    code: 6003
  }),
NGPixel's avatar
NGPixel committed
188 189 190 191
  PagePathCollision: CustomError('PagePathCollision', {
    message: 'Destination page path already exists.',
    code: 6006
  }),
NGPixel's avatar
NGPixel committed
192 193 194 195
  PageRestoreForbidden: CustomError('PageRestoreForbidden', {
    message: 'You are not authorized to restore this page version.',
    code: 6011
  }),
NGPixel's avatar
NGPixel committed
196 197 198 199
  PageUpdateForbidden: CustomError('PageUpdateForbidden', {
    message: 'You are not authorized to update this page.',
    code: 6009
  }),
200 201 202 203
  PageViewForbidden: CustomError('PageViewForbidden', {
    message: 'You are not authorized to view this page.',
    code: 6013
  }),
204 205
  SearchActivationFailed: CustomError('SearchActivationFailed', {
    message: 'Search Engine activation failed.',
206 207 208 209 210
    code: 4002
  }),
  SearchGenericError: CustomError('SearchGenericError', {
    message: 'An unexpected error occured during search operation.',
    code: 4001
211
  }),
212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227
  SystemGenericError: CustomError('SystemGenericError', {
    message: 'An unexpected error occured.',
    code: 7001
  }),
  SystemSSLDisabled: CustomError('SystemSSLDisabled', {
    message: 'SSL is not enabled.',
    code: 7002
  }),
  SystemSSLLEUnavailable: CustomError('SystemSSLLEUnavailable', {
    message: 'Let\'s Encrypt is not initialized.',
    code: 7004
  }),
  SystemSSLRenewInvalidProvider: CustomError('SystemSSLRenewInvalidProvider', {
    message: 'Current provider does not support SSL certificate renewal.',
    code: 7003
  }),
228 229
  UserCreationFailed: CustomError('UserCreationFailed', {
    message: 'An unexpected error occured during user creation.',
230
    code: 1009
Nick's avatar
Nick committed
231
  }),
NGPixel's avatar
NGPixel committed
232 233 234 235 236 237 238 239
  UserDeleteForeignConstraint: CustomError('UserCreationFailed', {
    message: 'Cannot delete user because of content relational constraints.',
    code: 1017
  }),
  UserDeleteProtected: CustomError('UserDeleteProtected', {
    message: 'Cannot delete a protected system account.',
    code: 1018
  }),
Nick's avatar
Nick committed
240 241 242
  UserNotFound: CustomError('UserNotFound', {
    message: 'This user does not exist.',
    code: 1016
243
  })
244
}