fix: naming and redundancy issues
This commit is contained in:
parent
fff9523988
commit
40974dd501
15 changed files with 194 additions and 143 deletions
36
lib/new-admin/graphql/errors/authentication.js
Normal file
36
lib/new-admin/graphql/errors/authentication.js
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
const { ApolloError } = require('apollo-server-express')
|
||||
|
||||
class InvalidCredentialsError extends ApolloError {
|
||||
constructor(message) {
|
||||
super(message, 'INVALID_CREDENTIALS')
|
||||
Object.defineProperty(this, 'name', { value: 'InvalidCredentialsError' })
|
||||
}
|
||||
}
|
||||
|
||||
class UserAlreadyExistsError extends ApolloError {
|
||||
constructor(message) {
|
||||
super(message, 'USER_ALREADY_EXISTS')
|
||||
Object.defineProperty(this, 'name', { value: 'UserAlreadyExistsError' })
|
||||
}
|
||||
}
|
||||
|
||||
class InvalidTwoFactorError extends ApolloError {
|
||||
constructor(message) {
|
||||
super(message, 'INVALID_TWO_FACTOR_CODE')
|
||||
Object.defineProperty(this, 'name', { value: 'InvalidTwoFactorError' })
|
||||
}
|
||||
}
|
||||
|
||||
class InvalidUrlError extends ApolloError {
|
||||
constructor(message) {
|
||||
super(message, 'INVALID_URL_TOKEN')
|
||||
Object.defineProperty(this, 'name', { value: 'InvalidUrlError' })
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
InvalidCredentialsError,
|
||||
UserAlreadyExistsError,
|
||||
InvalidTwoFactorError,
|
||||
InvalidUrlError
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue