-
Notifications
You must be signed in to change notification settings - Fork 3
/
errors.js
48 lines (40 loc) · 988 Bytes
/
errors.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/* eslint-disable max-classes-per-file */
const {ApolloError} = require('apollo-server');
class AuthError extends ApolloError {
constructor(message = 'Not authorized') {
super(message, 'Auth');
}
}
class PaymentError extends ApolloError {
constructor(message = 'Not authorized') {
super(message, 'Payment');
}
}
class InsufficientDataError extends ApolloError {
constructor(message = 'Missing required data') {
super(message, 'InsufficientData');
}
}
class NotFoundError extends ApolloError {
constructor(message = 'Not found') {
super(message, 'NotFound');
}
}
class AlreadyExistingError extends ApolloError {
constructor(message = 'Already existing data') {
super(message, 'AlreadyExisting');
}
}
class FileTooBigError extends ApolloError {
constructor(message = 'File size is too big.') {
super(message, 'FileTooBig');
}
}
module.exports = {
AuthError,
InsufficientDataError,
NotFoundError,
AlreadyExistingError,
PaymentError,
FileTooBigError,
};