-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Expand file tree
/
Copy pathException.php
More file actions
528 lines (457 loc) · 25.9 KB
/
Copy pathException.php
File metadata and controls
528 lines (457 loc) · 25.9 KB
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
<?php
namespace Appwrite\Extend;
use Utopia\Config\Config;
class Exception extends \Exception
{
/**
* Error Codes
*
* Naming the error types based on the following convention
* <ENTITY>_<ERROR_TYPE>
*
* Appwrite has the following entities:
* - General
* - Users
* - Teams
* - Memberships
* - Avatars
* - Storage
* - Functions
* - Deployments
* - Executions
* - Collections
* - Documents
* - Attributes
* - Indexes
* - Projects
* - Webhooks
* - Keys
* - Platform
* - Domain
* - GraphQL
* - Migrations
*/
/** General */
public const string GENERAL_UNKNOWN = 'general_unknown';
public const string GENERAL_MOCK = 'general_mock';
public const string GENERAL_ACCESS_FORBIDDEN = 'general_access_forbidden';
public const string GENERAL_RESOURCE_BLOCKED = 'general_resource_blocked';
public const string GENERAL_UNKNOWN_ORIGIN = 'general_unknown_origin';
public const string GENERAL_API_DISABLED = 'general_api_disabled';
public const string GENERAL_SERVICE_DISABLED = 'general_service_disabled';
public const string GENERAL_UNAUTHORIZED_SCOPE = 'general_unauthorized_scope';
public const string GENERAL_RATE_LIMIT_EXCEEDED = 'general_rate_limit_exceeded';
public const string GENERAL_RESOURCE_LOCKED = 'general_resource_locked';
public const string GENERAL_SMTP_DISABLED = 'general_smtp_disabled';
public const string GENERAL_PHONE_DISABLED = 'general_phone_disabled';
public const string GENERAL_ARGUMENT_INVALID = 'general_argument_invalid';
public const string GENERAL_COLUMN_QUERY_LIMIT_EXCEEDED = 'general_column_query_limit_exceeded';
public const string GENERAL_ATTRIBUTE_QUERY_LIMIT_EXCEEDED = 'general_attribute_query_limit_exceeded';
public const string GENERAL_QUERY_INVALID = 'general_query_invalid';
public const string GENERAL_ROUTE_NOT_FOUND = 'general_route_not_found';
public const string GENERAL_CURSOR_NOT_FOUND = 'general_cursor_not_found';
public const string GENERAL_SERVER_ERROR = 'general_server_error';
public const string GENERAL_PROTOCOL_UNSUPPORTED = 'general_protocol_unsupported';
public const string GENERAL_FEATURE_UNSUPPORTED = 'general_feature_unsupported';
public const string GENERAL_CODES_DISABLED = 'general_codes_disabled';
public const string GENERAL_USAGE_DISABLED = 'general_usage_disabled';
public const string GENERAL_USAGE_NOT_READY = 'general_usage_not_ready';
public const string GENERAL_NOT_IMPLEMENTED = 'general_not_implemented';
public const string GENERAL_INVALID_EMAIL = 'general_invalid_email';
public const string GENERAL_INVALID_PHONE = 'general_invalid_phone';
public const string GENERAL_REGION_ACCESS_DENIED = 'general_region_access_denied';
public const string GENERAL_BAD_REQUEST = 'general_bad_request';
/** Users */
public const string USER_COUNT_EXCEEDED = 'user_count_exceeded';
public const string USER_CONSOLE_COUNT_EXCEEDED = 'user_console_count_exceeded';
public const string USER_JWT_INVALID = 'user_jwt_invalid';
public const string USER_ALREADY_EXISTS = 'user_already_exists';
public const string USER_BLOCKED = 'user_blocked';
public const string USER_INVALID_TOKEN = 'user_invalid_token';
public const string USER_PASSWORD_RESET_REQUIRED = 'user_password_reset_required';
public const string USER_EMAIL_NOT_WHITELISTED = 'user_email_not_whitelisted';
public const string USER_IP_NOT_WHITELISTED = 'user_ip_not_whitelisted';
public const string USER_INVALID_CODE = 'user_invalid_code';
public const string USER_INVALID_CREDENTIALS = 'user_invalid_credentials';
public const string USER_ANONYMOUS_CONSOLE_PROHIBITED = 'user_anonymous_console_prohibited';
public const string USER_SESSION_ALREADY_EXISTS = 'user_session_already_exists';
public const string USER_NOT_FOUND = 'user_not_found';
public const string USER_PASSWORD_RECENTLY_USED = 'password_recently_used';
public const string USER_PASSWORD_PERSONAL_DATA = 'password_personal_data';
public const string USER_EMAIL_ALREADY_EXISTS = 'user_email_already_exists';
public const string USER_EMAIL_DISPOSABLE = 'user_email_disposable';
public const string USER_EMAIL_FREE = 'user_email_free';
public const string USER_EMAIL_NOT_CORPORATE = 'user_email_not_corporate';
public const string USER_EMAIL_NOT_CANONICAL = 'user_email_not_canonical';
public const string USER_PASSWORD_MISMATCH = 'user_password_mismatch';
public const string USER_SESSION_NOT_FOUND = 'user_session_not_found';
public const string USER_IDENTITY_NOT_FOUND = 'user_identity_not_found';
public const string USER_UNAUTHORIZED = 'user_unauthorized';
public const string USER_AUTH_METHOD_UNSUPPORTED = 'user_auth_method_unsupported';
public const string USER_PHONE_ALREADY_EXISTS = 'user_phone_already_exists';
public const string USER_PHONE_NOT_FOUND = 'user_phone_not_found';
public const string USER_PHONE_NOT_VERIFIED = 'user_phone_not_verified';
public const string USER_EMAIL_NOT_FOUND = 'user_email_not_found';
public const string USER_EMAIL_NOT_VERIFIED = 'user_email_not_verified';
public const string USER_MISSING_ID = 'user_missing_id';
public const string USER_MORE_FACTORS_REQUIRED = 'user_more_factors_required';
public const string USER_AUTHENTICATOR_NOT_FOUND = 'user_authenticator_not_found';
public const string USER_AUTHENTICATOR_ALREADY_VERIFIED = 'user_authenticator_already_verified';
public const string USER_RECOVERY_CODES_ALREADY_EXISTS = 'user_recovery_codes_already_exists';
public const string USER_RECOVERY_CODES_NOT_FOUND = 'user_recovery_codes_not_found';
public const string USER_CHALLENGE_REQUIRED = 'user_challenge_required';
public const string USER_OAUTH2_BAD_REQUEST = 'user_oauth2_bad_request';
public const string USER_OAUTH2_UNAUTHORIZED = 'user_oauth2_unauthorized';
public const string USER_OAUTH2_TOKEN_INVALID = 'user_oauth2_token_invalid';
public const string USER_OAUTH2_PROVIDER_ERROR = 'user_oauth2_provider_error';
public const string USER_OAUTH2_PROVIDER_FAILURE = 'user_oauth2_provider_failure';
public const string USER_EMAIL_ALREADY_VERIFIED = 'user_email_already_verified';
public const string USER_PHONE_ALREADY_VERIFIED = 'user_phone_already_verified';
public const string USER_DELETION_PROHIBITED = 'user_deletion_prohibited';
public const string USER_TARGET_NOT_FOUND = 'user_target_not_found';
public const string USER_TARGET_ALREADY_EXISTS = 'user_target_already_exists';
public const string USER_API_KEY_AND_SESSION_SET = 'user_api_key_and_session_set';
public const string USER_JWT_AND_COOKIE_SET = 'user_jwt_and_cookie_set';
public const string USER_JWT_CREATION_DENIED = 'user_jwt_creation_denied';
public const string USER_ID_MISSING = 'user_id_missing';
public const string API_KEY_EXPIRED = 'api_key_expired';
/** Teams */
public const string TEAM_NOT_FOUND = 'team_not_found';
public const string TEAM_INVITE_NOT_FOUND = 'team_invite_not_found';
public const string TEAM_INVALID_SECRET = 'team_invalid_secret';
public const string TEAM_MEMBERSHIP_MISMATCH = 'team_membership_mismatch';
public const string TEAM_INVITE_MISMATCH = 'team_invite_mismatch';
public const string TEAM_ALREADY_EXISTS = 'team_already_exists';
public const string ORGANIZATION_ID_MISSING = 'organization_id_missing';
public const string ORGANIZATION_CREATION_PROHIBITED = 'organization_creation_prohibited';
/** Console */
public const string RESOURCE_ALREADY_EXISTS = 'resource_already_exists';
/** Membership */
public const string MEMBERSHIP_NOT_FOUND = 'membership_not_found';
public const string MEMBERSHIP_ALREADY_CONFIRMED = 'membership_already_confirmed';
public const string MEMBERSHIP_DELETION_PROHIBITED = 'membership_deletion_prohibited';
public const string MEMBERSHIP_DOWNGRADE_PROHIBITED = 'membership_downgrade_prohibited';
/** Avatars */
public const string AVATAR_SET_NOT_FOUND = 'avatar_set_not_found';
public const string AVATAR_NOT_FOUND = 'avatar_not_found';
public const string AVATAR_IMAGE_NOT_FOUND = 'avatar_image_not_found';
public const string AVATAR_REMOTE_URL_FAILED = 'avatar_remote_url_failed';
public const string AVATAR_ICON_NOT_FOUND = 'avatar_icon_not_found';
public const string AVATAR_SVG_SANITIZATION_FAILED = 'avatar_svg_sanitization_failed';
/** Storage */
public const string STORAGE_FILE_ALREADY_EXISTS = 'storage_file_already_exists';
public const string STORAGE_FILE_NOT_FOUND = 'storage_file_not_found';
public const string STORAGE_DEVICE_NOT_FOUND = 'storage_device_not_found';
public const string STORAGE_FILE_EMPTY = 'storage_file_empty';
public const string STORAGE_FILE_TYPE_UNSUPPORTED = 'storage_file_type_unsupported';
public const string STORAGE_IMAGE_RESOLUTION_EXCEEDED = 'storage_image_resolution_exceeded';
public const string STORAGE_INVALID_FILE_SIZE = 'storage_invalid_file_size';
public const string STORAGE_INVALID_FILE = 'storage_invalid_file';
public const string STORAGE_BUCKET_ALREADY_EXISTS = 'storage_bucket_already_exists';
public const string STORAGE_BUCKET_NOT_FOUND = 'storage_bucket_not_found';
public const string STORAGE_INVALID_CONTENT_RANGE = 'storage_invalid_content_range';
public const string STORAGE_INVALID_RANGE = 'storage_invalid_range';
public const string STORAGE_INVALID_APPWRITE_ID = 'storage_invalid_appwrite_id';
public const string STORAGE_FILE_NOT_PUBLIC = 'storage_file_not_public';
public const string STORAGE_BUCKET_TRANSFORMATIONS_DISABLED = 'storage_bucket_transformations_disabled';
/** VCS */
public const string INSTALLATION_NOT_FOUND = 'installation_not_found';
public const string PROVIDER_REPOSITORY_NOT_FOUND = 'provider_repository_not_found';
public const string REPOSITORY_NOT_FOUND = 'repository_not_found';
public const string PROVIDER_CONTRIBUTION_CONFLICT = 'provider_contribution_conflict';
public const string GENERAL_PROVIDER_FAILURE = 'general_provider_failure';
/** Sites */
public const string SITE_NOT_FOUND = 'site_not_found';
public const string SITE_ALREADY_EXISTS = 'site_already_exists';
public const string SITE_TEMPLATE_NOT_FOUND = 'site_template_not_found';
/** Functions */
public const string FUNCTION_NOT_FOUND = 'function_not_found';
public const string FUNCTION_ALREADY_EXISTS = 'function_already_exists';
public const string FUNCTION_RUNTIME_UNSUPPORTED = 'function_runtime_unsupported';
public const string FUNCTION_ENTRYPOINT_MISSING = 'function_entrypoint_missing';
public const string FUNCTION_SYNCHRONOUS_TIMEOUT = 'function_synchronous_timeout';
public const string FUNCTION_ASYNCHRONOUS_TIMEOUT = 'function_asynchronous_timeout';
public const string FUNCTION_TEMPLATE_NOT_FOUND = 'function_template_not_found';
public const string FUNCTION_RUNTIME_NOT_DETECTED = 'function_runtime_not_detected';
public const string FUNCTION_EXECUTE_PERMISSION_MISSING = 'function_execute_permission_missing';
/** Deployments */
public const string DEPLOYMENT_NOT_FOUND = 'deployment_not_found';
public const string DEPLOYMENT_INVALID_FILE_SIZE = 'deployment_invalid_file_size';
/** Builds */
public const string BUILD_NOT_FOUND = 'build_not_found';
public const string BUILD_NOT_READY = 'build_not_ready';
public const string BUILD_IN_PROGRESS = 'build_in_progress';
public const string BUILD_ALREADY_COMPLETED = 'build_already_completed';
public const string BUILD_CANCELED = 'build_canceled';
public const string BUILD_FAILED = 'build_failed';
public const string BUILD_TIMEOUT = 'build_timeout';
/** Execution */
public const string EXECUTION_NOT_FOUND = 'execution_not_found';
public const string EXECUTION_IN_PROGRESS = 'execution_in_progress';
/** Log */
public const string LOG_NOT_FOUND = 'log_not_found';
/** Presence */
public const string PRESENCE_NOT_FOUND = 'presence_not_found';
public const string PRESENCE_ALREADY_EXISTS = 'presence_already_exists';
/** Databases */
public const string DATABASE_NOT_FOUND = 'database_not_found';
public const string DATABASE_ALREADY_EXISTS = 'database_already_exists';
public const string DATABASE_TIMEOUT = 'database_timeout';
public const string DATABASE_QUERY_ORDER_NULL = 'database_query_order_null';
/** Collections */
public const string COLLECTION_NOT_FOUND = 'collection_not_found';
public const string COLLECTION_ALREADY_EXISTS = 'collection_already_exists';
public const string COLLECTION_LIMIT_EXCEEDED = 'collection_limit_exceeded';
/** Tables */
public const string TABLE_NOT_FOUND = 'table_not_found';
public const string TABLE_ALREADY_EXISTS = 'table_already_exists';
public const string TABLE_LIMIT_EXCEEDED = 'table_limit_exceeded';
/** Documents */
public const string DOCUMENT_NOT_FOUND = 'document_not_found';
public const string DOCUMENT_INVALID_STRUCTURE = 'document_invalid_structure';
public const string DOCUMENT_MISSING_DATA = 'document_missing_data';
public const string DOCUMENT_MISSING_PAYLOAD = 'document_missing_payload';
public const string DOCUMENT_ALREADY_EXISTS = 'document_already_exists';
public const string DOCUMENT_UNIQUE_CONSTRAINT_VIOLATION = 'document_unique_constraint_violation';
public const string DOCUMENT_UPDATE_CONFLICT = 'document_update_conflict';
public const string DOCUMENT_DELETE_RESTRICTED = 'document_delete_restricted';
/** Rows */
public const string ROW_NOT_FOUND = 'row_not_found';
public const string ROW_INVALID_STRUCTURE = 'row_invalid_structure';
public const string ROW_MISSING_DATA = 'row_missing_data';
public const string ROW_MISSING_PAYLOAD = 'row_missing_payload';
public const string ROW_ALREADY_EXISTS = 'row_already_exists';
public const string ROW_UNIQUE_CONSTRAINT_VIOLATION = 'row_unique_constraint_violation';
public const string ROW_UPDATE_CONFLICT = 'row_update_conflict';
public const string ROW_DELETE_RESTRICTED = 'row_delete_restricted';
/** Attributes */
public const string ATTRIBUTE_NOT_FOUND = 'attribute_not_found';
public const string ATTRIBUTE_UNKNOWN = 'attribute_unknown';
public const string ATTRIBUTE_NOT_AVAILABLE = 'attribute_not_available';
public const string ATTRIBUTE_FORMAT_UNSUPPORTED = 'attribute_format_unsupported';
public const string ATTRIBUTE_DEFAULT_UNSUPPORTED = 'attribute_default_unsupported';
public const string ATTRIBUTE_ALREADY_EXISTS = 'attribute_already_exists';
public const string ATTRIBUTE_LIMIT_EXCEEDED = 'attribute_limit_exceeded';
public const string ATTRIBUTE_VALUE_INVALID = 'attribute_value_invalid';
public const string ATTRIBUTE_TYPE_INVALID = 'attribute_type_invalid';
public const string ATTRIBUTE_INVALID_RESIZE = 'attribute_invalid_resize';
public const ATTRIBUTE_TYPE_NOT_SUPPORTED = 'ATTRIBUTE_TYPE_NOT_SUPPORTED';
/** Columns */
public const string COLUMN_NOT_FOUND = 'column_not_found';
public const string COLUMN_UNKNOWN = 'column_unknown';
public const string COLUMN_NOT_AVAILABLE = 'column_not_available';
public const string COLUMN_FORMAT_UNSUPPORTED = 'column_format_unsupported';
public const string COLUMN_DEFAULT_UNSUPPORTED = 'column_default_unsupported';
public const string COLUMN_ALREADY_EXISTS = 'column_already_exists';
public const string COLUMN_LIMIT_EXCEEDED = 'column_limit_exceeded';
public const string COLUMN_VALUE_INVALID = 'column_value_invalid';
public const string COLUMN_TYPE_INVALID = 'column_type_invalid';
public const string COLUMN_INVALID_RESIZE = 'column_invalid_resize';
public const COLUMN_TYPE_NOT_SUPPORTED = 'COLUMN_TYPE_NOT_SUPPORTED';
/** Relationship */
public const string RELATIONSHIP_VALUE_INVALID = 'relationship_value_invalid';
/** Indexes */
public const string INDEX_NOT_FOUND = 'index_not_found';
public const string INDEX_LIMIT_EXCEEDED = 'index_limit_exceeded';
public const string INDEX_ALREADY_EXISTS = 'index_already_exists';
public const string INDEX_INVALID = 'index_invalid';
public const string INDEX_DEPENDENCY = 'index_dependency';
/** Column Indexes */
public const string COLUMN_INDEX_NOT_FOUND = 'column_index_not_found';
public const string COLUMN_INDEX_LIMIT_EXCEEDED = 'column_index_limit_exceeded';
public const string COLUMN_INDEX_ALREADY_EXISTS = 'column_index_already_exists';
public const string COLUMN_INDEX_INVALID = 'column_index_invalid';
public const string COLUMN_INDEX_DEPENDENCY = 'column_index_dependency';
/** Transactions */
public const string TRANSACTION_NOT_FOUND = 'transaction_not_found';
public const string TRANSACTION_ALREADY_EXISTS = 'transaction_already_exists';
public const string TRANSACTION_INVALID = 'transaction_invalid';
public const string TRANSACTION_FAILED = 'transaction_failed';
public const string TRANSACTION_EXPIRED = 'transaction_expired';
public const string TRANSACTION_CONFLICT = 'transaction_conflict';
public const string TRANSACTION_LIMIT_EXCEEDED = 'transaction_limit_exceeded';
public const string TRANSACTION_NOT_READY = 'transaction_not_ready';
/** Projects */
public const string PROJECT_NOT_FOUND = 'project_not_found';
public const string PROJECT_ID_MISSING = 'project_id_missing';
public const string PROJECT_PROVIDER_DISABLED = 'project_provider_disabled';
public const string PROJECT_PROVIDER_UNSUPPORTED = 'project_provider_unsupported';
public const string PROJECT_ALREADY_EXISTS = 'project_already_exists';
public const string PROJECT_INVALID_SUCCESS_URL = 'project_invalid_success_url';
public const string PROJECT_INVALID_FAILURE_URL = 'project_invalid_failure_url';
public const string PROJECT_RESERVED_PROJECT = 'project_reserved_project';
public const string PROJECT_KEY_EXPIRED = 'project_key_expired';
public const string ACCOUNT_KEY_EXPIRED = 'account_key_expired';
public const string PROJECT_SMTP_CONFIG_INVALID = 'project_smtp_config_invalid';
public const string PROJECT_TEMPLATE_DEFAULT_DELETION = 'project_template_default_deletion';
public const string PROJECT_REGION_UNSUPPORTED = 'project_region_unsupported';
/** Webhooks */
public const string WEBHOOK_NOT_FOUND = 'webhook_not_found';
public const string WEBHOOK_ALREADY_EXISTS = 'webhook_already_exists';
/** Router */
public const string ROUTER_HOST_NOT_FOUND = 'router_host_not_found';
public const string ROUTER_DOMAIN_NOT_CONFIGURED = 'router_domain_not_configured';
/** Proxy */
public const string RULE_RESOURCE_NOT_FOUND = 'rule_resource_not_found';
public const string RULE_NOT_FOUND = 'rule_not_found';
public const string RULE_ALREADY_EXISTS = 'rule_already_exists';
public const string RULE_VERIFICATION_FAILED = 'rule_verification_failed';
/** Keys */
public const string KEY_NOT_FOUND = 'key_not_found';
public const string KEY_ALREADY_EXISTS = 'key_already_exists';
public const string KEY_CREATION_DENIED = 'key_creation_denied';
/** Dev Keys */
public const string DEV_KEY_GONE = 'dev_key_gone';
/** Variables */
public const string VARIABLE_NOT_FOUND = 'variable_not_found';
public const string VARIABLE_ALREADY_EXISTS = 'variable_already_exists';
public const string VARIABLE_CANNOT_UNSET_SECRET = 'variable_cannot_unset_secret';
public const string VARIABLE_INVALID_KEY = 'variable_invalid_key';
/** Platform */
public const string PLATFORM_NOT_FOUND = 'platform_not_found';
public const string PLATFORM_METHOD_UNSUPPORTED = 'platform_method_unsupported';
public const string PLATFORM_ALREADY_EXISTS = 'platform_already_exists';
/** GraphqQL */
public const string GRAPHQL_NO_QUERY = 'graphql_no_query';
public const string GRAPHQL_TOO_MANY_QUERIES = 'graphql_too_many_queries';
public const string GRAPHQL_METHOD_UNSUPPORTED = 'graphql_method_unsupported';
/** Migrations */
public const string MIGRATION_NOT_FOUND = 'migration_not_found';
public const string MIGRATION_ALREADY_EXISTS = 'migration_already_exists';
public const string MIGRATION_IN_PROGRESS = 'migration_in_progress';
public const string MIGRATION_PROVIDER_ERROR = 'migration_provider_error';
public const string MIGRATION_DATABASE_TYPE_UNSUPPORTED = 'migration_database_type_unsupported';
public const string MIGRATION_SOURCE_PROJECT_ID_REQUIRED = 'migration_source_project_id_required';
public const string MIGRATION_SOURCE_PROJECT_NOT_FOUND = 'migration_source_project_not_found';
public const string MIGRATION_SOURCE_TYPE_INVALID = 'migration_source_type_invalid';
public const string MIGRATION_DESTINATION_TYPE_INVALID = 'migration_destination_type_invalid';
/** Realtime */
public const string REALTIME_MESSAGE_FORMAT_INVALID = 'realtime_message_format_invalid';
public const string REALTIME_TOO_MANY_MESSAGES = 'realtime_too_many_messages';
public const string REALTIME_POLICY_VIOLATION = 'realtime_policy_violation';
/** Health */
public const string HEALTH_QUEUE_SIZE_EXCEEDED = 'health_queue_size_exceeded';
public const string HEALTH_CERTIFICATE_EXPIRED = 'health_certificate_expired';
public const string HEALTH_INVALID_HOST = 'health_invalid_host';
/** Provider */
public const string PROVIDER_NOT_FOUND = 'provider_not_found';
public const string PROVIDER_ALREADY_EXISTS = 'provider_already_exists';
public const string PROVIDER_INCORRECT_TYPE = 'provider_incorrect_type';
public const string PROVIDER_MISSING_CREDENTIALS = 'provider_missing_credentials';
/** Topic */
public const string TOPIC_NOT_FOUND = 'topic_not_found';
public const string TOPIC_ALREADY_EXISTS = 'topic_already_exists';
/** Subscriber */
public const string SUBSCRIBER_NOT_FOUND = 'subscriber_not_found';
public const string SUBSCRIBER_ALREADY_EXISTS = 'subscriber_already_exists';
/** Message */
public const string MESSAGE_NOT_FOUND = 'message_not_found';
public const string MESSAGE_ALREADY_EXISTS = 'message_already_exists';
public const string MESSAGE_MISSING_TARGET = 'message_missing_target';
public const string MESSAGE_ALREADY_SENT = 'message_already_sent';
public const string MESSAGE_ALREADY_PROCESSING = 'message_already_processing';
public const string MESSAGE_ALREADY_FAILED = 'message_already_failed';
public const string MESSAGE_ALREADY_SCHEDULED = 'message_already_scheduled';
public const string MESSAGE_TARGET_NOT_EMAIL = 'message_target_not_email';
public const string MESSAGE_TARGET_NOT_SMS = 'message_target_not_sms';
public const string MESSAGE_TARGET_NOT_PUSH = 'message_target_not_push';
public const string MESSAGE_MISSING_SCHEDULE = 'message_missing_schedule';
/** Mocks */
public const string MOCK_NUMBER_ALREADY_EXISTS = 'mock_number_already_exists';
public const string MOCK_NUMBER_NOT_FOUND = 'mock_number_not_found';
public const string MOCK_NUMBER_LIMIT_EXCEEDED = 'mock_number_limit_exceeded';
/** Targets */
public const string TARGET_PROVIDER_INVALID_TYPE = 'target_provider_invalid_type';
/** Schedules */
public const string SCHEDULE_NOT_FOUND = 'schedule_not_found';
/** Tokens */
public const string TOKEN_NOT_FOUND = 'token_not_found';
public const string TOKEN_EXPIRED = 'token_expired';
public const string TOKEN_RESOURCE_TYPE_INVALID = 'token_resource_type_invalid';
/** Advisor */
public const string INSIGHT_NOT_FOUND = 'insight_not_found';
public const string INSIGHT_ALREADY_EXISTS = 'insight_already_exists';
/** Reports */
public const string REPORT_NOT_FOUND = 'report_not_found';
public const string REPORT_ALREADY_EXISTS = 'report_already_exists';
protected string $type = '';
protected array $errors = [];
protected bool $publish;
private array $ctas = [];
private ?string $view = null;
public function __construct(
string $type = Exception::GENERAL_UNKNOWN,
?string $message = null,
int|string|null $code = null,
?\Throwable $previous = null,
?string $view = null,
array $params = []
) {
$this->errors = Config::getParam('errors');
$this->type = $type;
$this->view = $view;
$this->code = $code ?? $this->errors[$type]['code'];
// Mark string errors like HY001 from PDO as 500 errors
if (\is_string($this->code)) {
if (\is_numeric($this->code)) {
$this->code = (int)$this->code;
} else {
$this->code = 500;
}
}
// Format message with params if provided
if (!empty($params) && $message === null) {
$description = $this->errors[$type]['description'] ?? '';
$this->message = !empty($description) ? sprintf($description, ...$params) : '';
} else {
$this->message = $message ?? $this->errors[$type]['description'];
}
$this->publish = $this->errors[$type]['publish'] ?? ($this->code >= 500);
parent::__construct($this->message, $this->code, $previous);
}
/**
* Get the type of the exception.
*
* @return string
*/
public function getType(): string
{
return $this->type;
}
/**
* Set the type of the exception.
*
* @param string $type
*
* @return void
*/
public function setType(string $type): void
{
$this->type = $type;
}
/**
* Check whether the log is publishable for the exception.
*
* @return bool
*/
public function isPublishable(): bool
{
return $this->publish;
}
public function addCTA(string $label, ?string $url = null): self
{
$this->ctas[] = [
'label' => $label,
'url' => $url
];
return $this;
}
public function getCTAs(): array
{
return $this->ctas;
}
public function getView(): ?string
{
return $this->view;
}
}