wikijs-fork/server/helpers/error.js

245 lines
8.3 KiB
JavaScript
Raw Permalink Normal View History

const CustomError = require('custom-error-instance')
2018-01-10 01:41:53 +00:00
module.exports = {
2019-05-26 01:38:29 +00:00
AssetDeleteForbidden: CustomError('AssetDeleteForbidden', {
message: 'You are not authorized to delete this asset.',
code: 2003
}),
2019-05-21 20:45:27 +00:00
AssetFolderExists: CustomError('AssetFolderExists', {
message: 'An asset folder with the same name already exists.',
2019-05-26 01:38:29 +00:00
code: 2002
}),
AssetGenericError: CustomError('AssetGenericError', {
2019-06-08 04:07:30 +00:00
message: 'An unexpected error occured during asset operation.',
2019-05-21 20:45:27 +00:00
code: 2001
}),
2019-05-26 01:38:29 +00:00
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
}),
AuthAccountBanned: CustomError('AuthAccountBanned', {
message: 'Your account has been disabled.',
2019-06-08 04:07:30 +00:00
code: 1013
}),
AuthAccountAlreadyExists: CustomError('AuthAccountAlreadyExists', {
message: 'An account already exists using this email address.',
code: 1004
}),
AuthAccountNotVerified: CustomError('AuthAccountNotVerified', {
message: 'You must verify your account before your can login.',
2019-06-08 04:07:30 +00:00
code: 1014
}),
AuthGenericError: CustomError('AuthGenericError', {
message: 'An unexpected error occured during login.',
code: 1001
}),
AuthLoginFailed: CustomError('AuthLoginFailed', {
message: 'Invalid email / username or password.',
code: 1002
}),
AuthPasswordInvalid: CustomError('AuthPasswordInvalid', {
message: 'Password is incorrect.',
code: 1020
}),
AuthProviderInvalid: CustomError('AuthProviderInvalid', {
message: 'Invalid authentication provider.',
code: 1003
}),
AuthRegistrationDisabled: CustomError('AuthRegistrationDisabled', {
message: 'Registration is disabled. Contact your system administrator.',
2019-06-08 04:07:30 +00:00
code: 1010
}),
AuthRegistrationDomainUnauthorized: CustomError('AuthRegistrationDomainUnauthorized', {
2019-06-08 04:07:30 +00:00
message: 'You are not authorized to register. Your domain is not whitelisted.',
code: 1011
}),
2020-03-30 05:30:10 +00:00
AuthRequired: CustomError('AuthRequired', {
message: 'You must be authenticated to access this resource.',
code: 1019
}),
AuthTFAFailed: CustomError('AuthTFAFailed', {
message: 'Incorrect TFA Security Code.',
code: 1005
}),
AuthTFAInvalid: CustomError('AuthTFAInvalid', {
message: 'Invalid TFA Security Code or Login Token.',
code: 1006
}),
2018-12-24 06:03:10 +00:00
AuthValidationTokenInvalid: CustomError('AuthValidationTokenInvalid', {
message: 'Invalid validation token.',
2019-06-08 04:07:30 +00:00
code: 1015
2018-12-24 06:03:10 +00:00
}),
BruteInstanceIsInvalid: CustomError('BruteInstanceIsInvalid', {
message: 'Invalid Brute Force Instance.',
code: 1007
}),
BruteTooManyAttempts: CustomError('BruteTooManyAttempts', {
message: 'Too many attempts! Try again later.',
code: 1008
}),
CommentContentMissing: CustomError('CommentContentMissing', {
message: 'Comment content is missing or too short.',
code: 8003
}),
2020-05-31 22:15:15 +00:00
CommentGenericError: CustomError('CommentGenericError', {
message: 'An unexpected error occured.',
code: 8001
}),
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
}),
2020-05-31 22:15:15 +00:00
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
}),
InputInvalid: CustomError('InputInvalid', {
message: 'Input data is invalid.',
2019-06-08 04:07:30 +00:00
code: 1012
}),
2019-06-08 04:07:30 +00:00
LocaleGenericError: CustomError('LocaleGenericError', {
message: 'An unexpected error occured during locale operation.',
code: 5001
}),
LocaleInvalidNamespace: CustomError('LocaleInvalidNamespace', {
message: 'Invalid locale or namespace.',
2019-06-08 04:07:30 +00:00
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
}),
2019-10-13 23:59:50 +00:00
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
}),
2019-06-29 20:45:27 +00:00
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
}),
2019-08-27 03:19:39 +00:00
PageEmptyContent: CustomError('PageEmptyContent', {
message: 'Page content cannot be empty.',
code: 6004
}),
PageHistoryForbidden: CustomError('PageHistoryForbidden', {
message: 'You are not authorized to view the history of this page.',
code: 6012
}),
PageIllegalPath: CustomError('PageIllegalPath', {
message: 'Page path cannot contains illegal characters.',
code: 6005
}),
2019-10-13 23:59:50 +00:00
PageMoveForbidden: CustomError('PageMoveForbidden', {
message: 'You are not authorized to move this page.',
code: 6007
}),
2019-07-02 05:48:19 +00:00
PageNotFound: CustomError('PageNotFound', {
message: 'This page does not exist.',
code: 6003
}),
2019-10-13 23:59:50 +00:00
PagePathCollision: CustomError('PagePathCollision', {
message: 'Destination page path already exists.',
code: 6006
}),
2020-03-01 04:40:07 +00:00
PageRestoreForbidden: CustomError('PageRestoreForbidden', {
message: 'You are not authorized to restore this page version.',
code: 6011
}),
2019-10-13 23:59:50 +00:00
PageUpdateForbidden: CustomError('PageUpdateForbidden', {
message: 'You are not authorized to update this page.',
code: 6009
}),
PageViewForbidden: CustomError('PageViewForbidden', {
message: 'You are not authorized to view this page.',
code: 6013
}),
SearchActivationFailed: CustomError('SearchActivationFailed', {
message: 'Search Engine activation failed.',
2019-06-08 04:07:30 +00:00
code: 4002
}),
SearchGenericError: CustomError('SearchGenericError', {
message: 'An unexpected error occured during search operation.',
code: 4001
}),
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
}),
UserCreationFailed: CustomError('UserCreationFailed', {
message: 'An unexpected error occured during user creation.',
2019-06-08 04:07:30 +00:00
code: 1009
2019-08-17 22:29:58 +00:00
}),
UserDeleteForeignConstraint: CustomError('UserDeleteForeignConstraint', {
2019-12-22 21:08:18 +00:00
message: 'Cannot delete user because of content relational constraints.',
code: 1017
}),
UserDeleteProtected: CustomError('UserDeleteProtected', {
message: 'Cannot delete a protected system account.',
code: 1018
}),
2019-08-17 22:29:58 +00:00
UserNotFound: CustomError('UserNotFound', {
message: 'This user does not exist.',
code: 1016
})
2018-01-10 01:41:53 +00:00
}