mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2026-01-14 17:04:38 +00:00
all errors are user input errors
This commit is contained in:
parent
f0c790fde9
commit
0aa8632146
@ -1,6 +1,8 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
import { UserInputError } from 'apollo-server'
|
||||
|
||||
import CONFIG from '@config/index'
|
||||
import registrationConstants from '@constants/registrationBranded'
|
||||
// eslint-disable-next-line import/no-cycle
|
||||
@ -160,7 +162,7 @@ export default {
|
||||
).records[0].get('count')
|
||||
|
||||
if (parseInt(userInviteCodeAmount as string) >= CONFIG.INVITE_CODES_PERSONAL_PER_USER) {
|
||||
throw new Error('You have reached the maximum of Invite Codes you can generate')
|
||||
throw new UserInputError('You have reached the maximum of Invite Codes you can generate')
|
||||
}
|
||||
|
||||
let code = generateInviteCode()
|
||||
@ -199,7 +201,7 @@ export default {
|
||||
).records[0].get('count')
|
||||
|
||||
if (parseInt(userInviteCodeAmount as string) >= CONFIG.INVITE_CODES_GROUP_PER_USER) {
|
||||
throw new Error(
|
||||
throw new UserInputError(
|
||||
'You have reached the maximum of Invite Codes you can generate for this group',
|
||||
)
|
||||
}
|
||||
@ -229,7 +231,7 @@ export default {
|
||||
|
||||
if (inviteCode.length !== 1) {
|
||||
// Not a member
|
||||
throw new Error('Not Authorized!')
|
||||
throw new UserInputError('Not Authorized!')
|
||||
}
|
||||
|
||||
return inviteCode[0].get('inviteCode')
|
||||
@ -247,7 +249,7 @@ export default {
|
||||
|
||||
if (result.length !== 1) {
|
||||
// Link not generated by this user or does not exist
|
||||
throw new Error('Not Authorized!')
|
||||
throw new UserInputError('Not Authorized!')
|
||||
}
|
||||
|
||||
return result[0].get('inviteCode')
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user