diff options
Diffstat (limited to 'packages/models/src/server/server-error-code.enum.ts')
-rw-r--r-- | packages/models/src/server/server-error-code.enum.ts | 92 |
1 files changed, 92 insertions, 0 deletions
diff --git a/packages/models/src/server/server-error-code.enum.ts b/packages/models/src/server/server-error-code.enum.ts new file mode 100644 index 000000000..dc200c1ea --- /dev/null +++ b/packages/models/src/server/server-error-code.enum.ts | |||
@@ -0,0 +1,92 @@ | |||
1 | export const ServerErrorCode = { | ||
2 | /** | ||
3 | * The simplest form of payload too large: when the file size is over the | ||
4 | * global file size limit | ||
5 | */ | ||
6 | MAX_FILE_SIZE_REACHED:'max_file_size_reached', | ||
7 | |||
8 | /** | ||
9 | * The payload is too large for the user quota set | ||
10 | */ | ||
11 | QUOTA_REACHED:'quota_reached', | ||
12 | |||
13 | /** | ||
14 | * Error yielded upon trying to access a video that is not federated, nor can | ||
15 | * be. This may be due to: remote videos on instances that are not followed by | ||
16 | * yours, and with your instance disallowing unknown instances being accessed. | ||
17 | */ | ||
18 | DOES_NOT_RESPECT_FOLLOW_CONSTRAINTS:'does_not_respect_follow_constraints', | ||
19 | |||
20 | LIVE_NOT_ENABLED:'live_not_enabled', | ||
21 | LIVE_NOT_ALLOWING_REPLAY:'live_not_allowing_replay', | ||
22 | LIVE_CONFLICTING_PERMANENT_AND_SAVE_REPLAY:'live_conflicting_permanent_and_save_replay', | ||
23 | /** | ||
24 | * Pretty self-explanatory: the set maximum number of simultaneous lives was | ||
25 | * reached, and this error is typically there to inform the user trying to | ||
26 | * broadcast one. | ||
27 | */ | ||
28 | MAX_INSTANCE_LIVES_LIMIT_REACHED:'max_instance_lives_limit_reached', | ||
29 | /** | ||
30 | * Pretty self-explanatory: the set maximum number of simultaneous lives FOR | ||
31 | * THIS USER was reached, and this error is typically there to inform the user | ||
32 | * trying to broadcast one. | ||
33 | */ | ||
34 | MAX_USER_LIVES_LIMIT_REACHED:'max_user_lives_limit_reached', | ||
35 | |||
36 | /** | ||
37 | * A torrent should have at most one correct video file. Any more and we will | ||
38 | * not be able to choose automatically. | ||
39 | */ | ||
40 | INCORRECT_FILES_IN_TORRENT:'incorrect_files_in_torrent', | ||
41 | |||
42 | COMMENT_NOT_ASSOCIATED_TO_VIDEO:'comment_not_associated_to_video', | ||
43 | |||
44 | MISSING_TWO_FACTOR:'missing_two_factor', | ||
45 | INVALID_TWO_FACTOR:'invalid_two_factor', | ||
46 | |||
47 | ACCOUNT_WAITING_FOR_APPROVAL:'account_waiting_for_approval', | ||
48 | ACCOUNT_APPROVAL_REJECTED:'account_approval_rejected', | ||
49 | |||
50 | RUNNER_JOB_NOT_IN_PROCESSING_STATE:'runner_job_not_in_processing_state', | ||
51 | RUNNER_JOB_NOT_IN_PENDING_STATE:'runner_job_not_in_pending_state', | ||
52 | UNKNOWN_RUNNER_TOKEN:'unknown_runner_token', | ||
53 | |||
54 | VIDEO_REQUIRES_PASSWORD:'video_requires_password', | ||
55 | INCORRECT_VIDEO_PASSWORD:'incorrect_video_password', | ||
56 | |||
57 | VIDEO_ALREADY_BEING_TRANSCODED:'video_already_being_transcoded' | ||
58 | } as const | ||
59 | |||
60 | /** | ||
61 | * oauthjs/oauth2-server error codes | ||
62 | * @see https://datatracker.ietf.org/doc/html/rfc6749#section-5.2 | ||
63 | **/ | ||
64 | export const OAuth2ErrorCode = { | ||
65 | /** | ||
66 | * The provided authorization grant (e.g., authorization code, resource owner | ||
67 | * credentials) or refresh token is invalid, expired, revoked, does not match | ||
68 | * the redirection URI used in the authorization request, or was issued to | ||
69 | * another client. | ||
70 | * | ||
71 | * @see https://github.com/oauthjs/node-oauth2-server/blob/master/lib/errors/invalid-grant-error.js | ||
72 | */ | ||
73 | INVALID_GRANT: 'invalid_grant', | ||
74 | |||
75 | /** | ||
76 | * Client authentication failed (e.g., unknown client, no client authentication | ||
77 | * included, or unsupported authentication method). | ||
78 | * | ||
79 | * @see https://github.com/oauthjs/node-oauth2-server/blob/master/lib/errors/invalid-client-error.js | ||
80 | */ | ||
81 | INVALID_CLIENT: 'invalid_client', | ||
82 | |||
83 | /** | ||
84 | * The access token provided is expired, revoked, malformed, or invalid for other reasons | ||
85 | * | ||
86 | * @see https://github.com/oauthjs/node-oauth2-server/blob/master/lib/errors/invalid-token-error.js | ||
87 | */ | ||
88 | INVALID_TOKEN: 'invalid_token' | ||
89 | } as const | ||
90 | |||
91 | export type OAuth2ErrorCodeType = typeof OAuth2ErrorCode[keyof typeof OAuth2ErrorCode] | ||
92 | export type ServerErrorCodeType = typeof ServerErrorCode[keyof typeof ServerErrorCode] | ||