stacker.news/lib/error.js
k00b 153455983e Revert "Encrypted device sync (#1373)"
This reverts commit a9a566a79f1ce59255f85127a58642beb6b70241.
2024-10-04 15:00:13 -05:00

24 lines
630 B
JavaScript

import { GraphQLError } from 'graphql'
export const E_FORBIDDEN = 'E_FORBIDDEN'
export const E_UNAUTHENTICATED = 'E_UNAUTHENTICATED'
export const E_BAD_INPUT = 'E_BAD_INPUT'
export class GqlAuthorizationError extends GraphQLError {
constructor (message) {
super(message, { extensions: { code: E_FORBIDDEN } })
}
}
export class GqlAuthenticationError extends GraphQLError {
constructor () {
super('you must be logged in', { extensions: { code: E_UNAUTHENTICATED } })
}
}
export class GqlInputError extends GraphQLError {
constructor (message) {
super(message, { extensions: { code: E_BAD_INPUT } })
}
}