-
-
Notifications
You must be signed in to change notification settings - Fork 265
/
errors.js
34 lines (26 loc) · 1.09 KB
/
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
import { createError } from 'apollo-errors';
export const Unauthorized = createError('Unauthorized', {
message: 'You need to be authenticated to perform this action',
});
export const Forbidden = createError('Forbidden', {
message: 'You are authenticated but forbidden to perform this action',
});
export const RateLimitExceeded = createError('RateLimitExceeded', {
message: 'Rate limit exceeded',
});
export const ValidationFailed = createError('ValidationFailed', {
message: 'Please verify the input data',
});
export const NotFound = createError('NotFound', {
message: 'Item not found',
});
export const InvalidToken = createError('InvalidToken', {
message: 'The provided token is not valid',
});
export const FeatureNotSupportedForCollective = createError('FeatureNotSupportedForCollective', {
message: 'This feature is not supported by the Collective',
});
/** An error to throw when `canUseFeature` returns false (user is not allowed to use this) */
export const FeatureNotAllowedForUser = createError('FeatureNotAllowedForUser', {
message: "You're not allowed to use this feature",
});