2022-01-29 22:15:01 +00:00
|
|
|
<?php
|
|
|
|
|
|
2022-01-29 22:49:52 +00:00
|
|
|
namespace Appwrite\Extend;
|
2022-01-29 22:15:01 +00:00
|
|
|
|
2022-07-25 22:54:08 +00:00
|
|
|
use Utopia\Config\Config;
|
|
|
|
|
|
2022-01-29 22:15:01 +00:00
|
|
|
class Exception extends \Exception
|
|
|
|
|
{
|
|
|
|
|
/**
|
|
|
|
|
* Error Codes
|
2022-05-23 14:54:50 +00:00
|
|
|
*
|
|
|
|
|
* Naming the error types based on the following convention
|
2022-02-01 08:39:07 +00:00
|
|
|
* <ENTITY>_<ERROR_TYPE>
|
2022-05-23 14:54:50 +00:00
|
|
|
*
|
2022-09-21 17:23:36 +00:00
|
|
|
* Appwrite has the following entities:
|
2022-02-07 21:10:36 +00:00
|
|
|
* - General
|
2022-02-01 08:39:07 +00:00
|
|
|
* - Users
|
|
|
|
|
* - Teams
|
|
|
|
|
* - Memberships
|
2022-02-06 21:42:03 +00:00
|
|
|
* - Avatars
|
|
|
|
|
* - Storage
|
2022-02-01 08:39:07 +00:00
|
|
|
* - Functions
|
|
|
|
|
* - Deployments
|
|
|
|
|
* - Executions
|
2022-02-06 21:42:03 +00:00
|
|
|
* - Collections
|
|
|
|
|
* - Documents
|
|
|
|
|
* - Attributes
|
|
|
|
|
* - Indexes
|
|
|
|
|
* - Projects
|
|
|
|
|
* - Webhooks
|
|
|
|
|
* - Keys
|
|
|
|
|
* - Platform
|
|
|
|
|
* - Domain
|
2022-04-26 07:49:36 +00:00
|
|
|
* - GraphQL
|
2023-08-04 16:21:41 +00:00
|
|
|
* - Migrations
|
2022-02-01 08:39:07 +00:00
|
|
|
*/
|
|
|
|
|
|
2022-02-07 21:10:36 +00:00
|
|
|
/** General */
|
2023-08-23 20:23:52 +00:00
|
|
|
public const GENERAL_UNKNOWN = 'general_unknown';
|
|
|
|
|
public const GENERAL_MOCK = 'general_mock';
|
|
|
|
|
public const GENERAL_ACCESS_FORBIDDEN = 'general_access_forbidden';
|
2024-10-17 11:32:42 +00:00
|
|
|
public const GENERAL_RESOURCE_BLOCKED = 'general_resource_blocked';
|
2023-08-23 20:23:52 +00:00
|
|
|
public const GENERAL_UNKNOWN_ORIGIN = 'general_unknown_origin';
|
2024-03-04 22:12:54 +00:00
|
|
|
public const GENERAL_API_DISABLED = 'general_api_disabled';
|
2023-08-23 20:23:52 +00:00
|
|
|
public const GENERAL_SERVICE_DISABLED = 'general_service_disabled';
|
|
|
|
|
public const GENERAL_UNAUTHORIZED_SCOPE = 'general_unauthorized_scope';
|
|
|
|
|
public const GENERAL_RATE_LIMIT_EXCEEDED = 'general_rate_limit_exceeded';
|
|
|
|
|
public const GENERAL_SMTP_DISABLED = 'general_smtp_disabled';
|
|
|
|
|
public const GENERAL_PHONE_DISABLED = 'general_phone_disabled';
|
|
|
|
|
public const GENERAL_ARGUMENT_INVALID = 'general_argument_invalid';
|
|
|
|
|
public const GENERAL_QUERY_LIMIT_EXCEEDED = 'general_query_limit_exceeded';
|
|
|
|
|
public const GENERAL_QUERY_INVALID = 'general_query_invalid';
|
|
|
|
|
public const GENERAL_ROUTE_NOT_FOUND = 'general_route_not_found';
|
|
|
|
|
public const GENERAL_CURSOR_NOT_FOUND = 'general_cursor_not_found';
|
|
|
|
|
public const GENERAL_SERVER_ERROR = 'general_server_error';
|
|
|
|
|
public const GENERAL_PROTOCOL_UNSUPPORTED = 'general_protocol_unsupported';
|
|
|
|
|
public const GENERAL_CODES_DISABLED = 'general_codes_disabled';
|
|
|
|
|
public const GENERAL_USAGE_DISABLED = 'general_usage_disabled';
|
2023-08-25 15:13:25 +00:00
|
|
|
public const GENERAL_NOT_IMPLEMENTED = 'general_not_implemented';
|
2023-11-21 09:30:02 +00:00
|
|
|
public const GENERAL_INVALID_EMAIL = 'general_invalid_email';
|
|
|
|
|
public const GENERAL_INVALID_PHONE = 'general_invalid_phone';
|
2024-01-29 11:19:13 +00:00
|
|
|
public const GENERAL_REGION_ACCESS_DENIED = 'general_region_access_denied';
|
2024-03-01 07:37:31 +00:00
|
|
|
public const GENERAL_BAD_REQUEST = 'general_bad_request';
|
2022-02-07 21:10:36 +00:00
|
|
|
|
2022-02-01 08:39:07 +00:00
|
|
|
/** Users */
|
2023-08-23 20:23:52 +00:00
|
|
|
public const USER_COUNT_EXCEEDED = 'user_count_exceeded';
|
2024-04-18 21:08:47 +00:00
|
|
|
public const USER_CONSOLE_COUNT_EXCEEDED = 'user_console_count_exceeded';
|
2023-08-23 20:23:52 +00:00
|
|
|
public const USER_JWT_INVALID = 'user_jwt_invalid';
|
|
|
|
|
public const USER_ALREADY_EXISTS = 'user_already_exists';
|
|
|
|
|
public const USER_BLOCKED = 'user_blocked';
|
|
|
|
|
public const USER_INVALID_TOKEN = 'user_invalid_token';
|
|
|
|
|
public const USER_PASSWORD_RESET_REQUIRED = 'user_password_reset_required';
|
|
|
|
|
public const USER_EMAIL_NOT_WHITELISTED = 'user_email_not_whitelisted';
|
|
|
|
|
public const USER_IP_NOT_WHITELISTED = 'user_ip_not_whitelisted';
|
|
|
|
|
public const USER_INVALID_CODE = 'user_invalid_code';
|
|
|
|
|
public const USER_INVALID_CREDENTIALS = 'user_invalid_credentials';
|
2022-06-02 13:03:37 +00:00
|
|
|
public const USER_ANONYMOUS_CONSOLE_PROHIBITED = 'user_anonymous_console_prohibited';
|
2023-08-23 20:23:52 +00:00
|
|
|
public const USER_SESSION_ALREADY_EXISTS = 'user_session_already_exists';
|
|
|
|
|
public const USER_NOT_FOUND = 'user_not_found';
|
|
|
|
|
public const USER_PASSWORD_RECENTLY_USED = 'password_recently_used';
|
|
|
|
|
public const USER_PASSWORD_PERSONAL_DATA = 'password_personal_data';
|
|
|
|
|
public const USER_EMAIL_ALREADY_EXISTS = 'user_email_already_exists';
|
|
|
|
|
public const USER_PASSWORD_MISMATCH = 'user_password_mismatch';
|
|
|
|
|
public const USER_SESSION_NOT_FOUND = 'user_session_not_found';
|
|
|
|
|
public const USER_IDENTITY_NOT_FOUND = 'user_identity_not_found';
|
|
|
|
|
public const USER_UNAUTHORIZED = 'user_unauthorized';
|
|
|
|
|
public const USER_AUTH_METHOD_UNSUPPORTED = 'user_auth_method_unsupported';
|
|
|
|
|
public const USER_PHONE_ALREADY_EXISTS = 'user_phone_already_exists';
|
|
|
|
|
public const USER_PHONE_NOT_FOUND = 'user_phone_not_found';
|
2023-06-22 13:35:49 +00:00
|
|
|
public const USER_PHONE_NOT_VERIFIED = 'user_phone_not_verified';
|
|
|
|
|
public const USER_EMAIL_NOT_FOUND = 'user_email_not_found';
|
|
|
|
|
public const USER_EMAIL_NOT_VERIFIED = 'user_email_not_verified';
|
2023-08-23 20:23:52 +00:00
|
|
|
public const USER_MISSING_ID = 'user_missing_id';
|
2023-06-22 13:35:49 +00:00
|
|
|
public const USER_MORE_FACTORS_REQUIRED = 'user_more_factors_required';
|
|
|
|
|
public const USER_INVALID_CHALLENGE = 'user_invalid_challenge';
|
2024-03-01 17:04:09 +00:00
|
|
|
public const USER_AUTHENTICATOR_NOT_FOUND = 'user_authenticator_not_found';
|
|
|
|
|
public const USER_AUTHENTICATOR_ALREADY_VERIFIED = 'user_authenticator_already_verified';
|
2024-03-01 16:22:51 +00:00
|
|
|
public const USER_RECOVERY_CODES_ALREADY_EXISTS = 'user_recovery_codes_already_exists';
|
2024-03-02 13:05:22 +00:00
|
|
|
public const USER_RECOVERY_CODES_NOT_FOUND = 'user_recovery_codes_not_found';
|
|
|
|
|
public const USER_CHALLENGE_REQUIRED = 'user_challenge_required';
|
2023-08-23 20:23:52 +00:00
|
|
|
public const USER_OAUTH2_BAD_REQUEST = 'user_oauth2_bad_request';
|
|
|
|
|
public const USER_OAUTH2_UNAUTHORIZED = 'user_oauth2_unauthorized';
|
|
|
|
|
public const USER_OAUTH2_PROVIDER_ERROR = 'user_oauth2_provider_error';
|
2024-02-15 09:36:34 +00:00
|
|
|
public const USER_EMAIL_ALREADY_VERIFIED = 'user_email_already_verified';
|
|
|
|
|
public const USER_PHONE_ALREADY_VERIFIED = 'user_phone_already_verified';
|
2024-02-11 09:10:14 +00:00
|
|
|
public const USER_DELETION_PROHIBITED = 'user_deletion_prohibited';
|
2023-08-23 20:23:52 +00:00
|
|
|
public const USER_TARGET_NOT_FOUND = 'user_target_not_found';
|
|
|
|
|
public const USER_TARGET_ALREADY_EXISTS = 'user_target_already_exists';
|
2024-02-20 11:45:11 +00:00
|
|
|
public const USER_API_KEY_AND_SESSION_SET = 'user_key_and_session_set';
|
2022-02-06 12:49:01 +00:00
|
|
|
|
2024-05-06 09:55:59 +00:00
|
|
|
public const API_KEY_EXPIRED = 'api_key_expired';
|
|
|
|
|
|
2022-02-06 14:52:21 +00:00
|
|
|
/** Teams */
|
2023-08-23 20:23:52 +00:00
|
|
|
public const TEAM_NOT_FOUND = 'team_not_found';
|
|
|
|
|
public const TEAM_INVITE_NOT_FOUND = 'team_invite_not_found';
|
|
|
|
|
public const TEAM_INVALID_SECRET = 'team_invalid_secret';
|
|
|
|
|
public const TEAM_MEMBERSHIP_MISMATCH = 'team_membership_mismatch';
|
|
|
|
|
public const TEAM_INVITE_MISMATCH = 'team_invite_mismatch';
|
|
|
|
|
public const TEAM_ALREADY_EXISTS = 'team_already_exists';
|
2022-02-06 14:52:21 +00:00
|
|
|
|
2024-11-17 17:15:03 +00:00
|
|
|
/** Console */
|
|
|
|
|
public const RESOURCE_ALREADY_EXISTS = 'resource_already_exists';
|
|
|
|
|
|
2022-02-06 14:52:21 +00:00
|
|
|
/** Membership */
|
2023-08-23 20:23:52 +00:00
|
|
|
public const MEMBERSHIP_NOT_FOUND = 'membership_not_found';
|
|
|
|
|
public const MEMBERSHIP_ALREADY_CONFIRMED = 'membership_already_confirmed';
|
2022-02-06 14:52:21 +00:00
|
|
|
|
2022-02-06 14:10:12 +00:00
|
|
|
/** Avatars */
|
2023-08-23 20:23:52 +00:00
|
|
|
public const AVATAR_SET_NOT_FOUND = 'avatar_set_not_found';
|
|
|
|
|
public const AVATAR_NOT_FOUND = 'avatar_not_found';
|
|
|
|
|
public const AVATAR_IMAGE_NOT_FOUND = 'avatar_image_not_found';
|
|
|
|
|
public const AVATAR_REMOTE_URL_FAILED = 'avatar_remote_url_failed';
|
|
|
|
|
public const AVATAR_ICON_NOT_FOUND = 'avatar_icon_not_found';
|
2022-02-06 14:10:12 +00:00
|
|
|
|
2022-02-06 14:32:28 +00:00
|
|
|
/** Storage */
|
2023-08-22 17:38:43 +00:00
|
|
|
public const STORAGE_FILE_ALREADY_EXISTS = 'storage_file_already_exists';
|
2023-08-23 20:23:52 +00:00
|
|
|
public const STORAGE_FILE_NOT_FOUND = 'storage_file_not_found';
|
|
|
|
|
public const STORAGE_DEVICE_NOT_FOUND = 'storage_device_not_found';
|
|
|
|
|
public const STORAGE_FILE_EMPTY = 'storage_file_empty';
|
|
|
|
|
public const STORAGE_FILE_TYPE_UNSUPPORTED = 'storage_file_type_unsupported';
|
|
|
|
|
public const STORAGE_INVALID_FILE_SIZE = 'storage_invalid_file_size';
|
|
|
|
|
public const STORAGE_INVALID_FILE = 'storage_invalid_file';
|
|
|
|
|
public const STORAGE_BUCKET_ALREADY_EXISTS = 'storage_bucket_already_exists';
|
|
|
|
|
public const STORAGE_BUCKET_NOT_FOUND = 'storage_bucket_not_found';
|
|
|
|
|
public const STORAGE_INVALID_CONTENT_RANGE = 'storage_invalid_content_range';
|
|
|
|
|
public const STORAGE_INVALID_RANGE = 'storage_invalid_range';
|
|
|
|
|
public const STORAGE_INVALID_APPWRITE_ID = 'storage_invalid_appwrite_id';
|
2024-02-15 09:36:34 +00:00
|
|
|
public const STORAGE_FILE_NOT_PUBLIC = 'storage_file_not_public';
|
2022-02-06 14:10:12 +00:00
|
|
|
|
2023-05-22 10:58:13 +00:00
|
|
|
/** VCS */
|
2024-02-15 09:36:34 +00:00
|
|
|
public const INSTALLATION_NOT_FOUND = 'installation_not_found';
|
|
|
|
|
public const PROVIDER_REPOSITORY_NOT_FOUND = 'provider_repository_not_found';
|
|
|
|
|
public const REPOSITORY_NOT_FOUND = 'repository_not_found';
|
|
|
|
|
public const PROVIDER_CONTRIBUTION_CONFLICT = 'provider_contribution_conflict';
|
|
|
|
|
public const GENERAL_PROVIDER_FAILURE = 'general_provider_failure';
|
2023-05-22 10:58:13 +00:00
|
|
|
|
2024-10-22 15:01:38 +00:00
|
|
|
/** Sites */
|
2024-10-22 17:45:49 +00:00
|
|
|
public const SITE_NOT_FOUND = 'site_not_found';
|
2024-10-22 15:01:38 +00:00
|
|
|
public const SITE_FRAMEWORK_UNSUPPORTED = 'site_framework_unsupported';
|
2024-10-25 12:55:09 +00:00
|
|
|
public const SITE_TEMPLATE_NOT_FOUND = 'site_template_not_found';
|
2024-10-22 15:01:38 +00:00
|
|
|
|
2022-02-06 16:12:15 +00:00
|
|
|
/** Functions */
|
2023-08-23 20:23:52 +00:00
|
|
|
public const FUNCTION_NOT_FOUND = 'function_not_found';
|
|
|
|
|
public const FUNCTION_RUNTIME_UNSUPPORTED = 'function_runtime_unsupported';
|
2024-02-15 09:36:34 +00:00
|
|
|
public const FUNCTION_ENTRYPOINT_MISSING = 'function_entrypoint_missing';
|
2024-05-20 16:16:47 +00:00
|
|
|
public const FUNCTION_SYNCHRONOUS_TIMEOUT = 'function_synchronous_timeout';
|
2024-07-30 11:46:45 +00:00
|
|
|
public const FUNCTION_TEMPLATE_NOT_FOUND = 'function_template_not_found';
|
2022-02-06 16:12:15 +00:00
|
|
|
|
|
|
|
|
/** Deployments */
|
2023-08-23 20:23:52 +00:00
|
|
|
public const DEPLOYMENT_NOT_FOUND = 'deployment_not_found';
|
2022-02-06 16:12:15 +00:00
|
|
|
|
2022-02-27 11:57:41 +00:00
|
|
|
/** Builds */
|
2023-08-23 20:23:52 +00:00
|
|
|
public const BUILD_NOT_FOUND = 'build_not_found';
|
|
|
|
|
public const BUILD_NOT_READY = 'build_not_ready';
|
|
|
|
|
public const BUILD_IN_PROGRESS = 'build_in_progress';
|
2024-05-30 20:23:29 +00:00
|
|
|
public const BUILD_ALREADY_COMPLETED = 'build_already_completed';
|
2022-02-27 11:57:41 +00:00
|
|
|
|
2022-02-06 16:12:15 +00:00
|
|
|
/** Execution */
|
2023-08-23 20:23:52 +00:00
|
|
|
public const EXECUTION_NOT_FOUND = 'execution_not_found';
|
2024-06-27 15:17:14 +00:00
|
|
|
public const EXECUTION_IN_PROGRESS = 'execution_in_progress';
|
2022-02-06 16:12:15 +00:00
|
|
|
|
2024-11-29 12:57:51 +00:00
|
|
|
/** Log */
|
|
|
|
|
public const LOG_NOT_FOUND = 'log_not_found';
|
|
|
|
|
|
2022-06-22 10:51:49 +00:00
|
|
|
/** Databases */
|
2023-08-23 20:23:52 +00:00
|
|
|
public const DATABASE_NOT_FOUND = 'database_not_found';
|
|
|
|
|
public const DATABASE_ALREADY_EXISTS = 'database_already_exists';
|
2023-10-19 02:32:45 +00:00
|
|
|
public const DATABASE_TIMEOUT = 'database_timeout';
|
2022-06-22 10:51:49 +00:00
|
|
|
|
2022-02-06 16:50:48 +00:00
|
|
|
/** Collections */
|
2023-08-23 20:23:52 +00:00
|
|
|
public const COLLECTION_NOT_FOUND = 'collection_not_found';
|
|
|
|
|
public const COLLECTION_ALREADY_EXISTS = 'collection_already_exists';
|
|
|
|
|
public const COLLECTION_LIMIT_EXCEEDED = 'collection_limit_exceeded';
|
2022-05-23 14:54:50 +00:00
|
|
|
|
2022-02-06 21:42:03 +00:00
|
|
|
/** Documents */
|
2023-08-23 20:23:52 +00:00
|
|
|
public const DOCUMENT_NOT_FOUND = 'document_not_found';
|
|
|
|
|
public const DOCUMENT_INVALID_STRUCTURE = 'document_invalid_structure';
|
|
|
|
|
public const DOCUMENT_MISSING_DATA = 'document_missing_data';
|
|
|
|
|
public const DOCUMENT_MISSING_PAYLOAD = 'document_missing_payload';
|
|
|
|
|
public const DOCUMENT_ALREADY_EXISTS = 'document_already_exists';
|
|
|
|
|
public const DOCUMENT_UPDATE_CONFLICT = 'document_update_conflict';
|
|
|
|
|
public const DOCUMENT_DELETE_RESTRICTED = 'document_delete_restricted';
|
2022-02-06 16:50:48 +00:00
|
|
|
|
|
|
|
|
/** Attribute */
|
2023-08-23 20:23:52 +00:00
|
|
|
public const ATTRIBUTE_NOT_FOUND = 'attribute_not_found';
|
|
|
|
|
public const ATTRIBUTE_UNKNOWN = 'attribute_unknown';
|
|
|
|
|
public const ATTRIBUTE_NOT_AVAILABLE = 'attribute_not_available';
|
|
|
|
|
public const ATTRIBUTE_FORMAT_UNSUPPORTED = 'attribute_format_unsupported';
|
|
|
|
|
public const ATTRIBUTE_DEFAULT_UNSUPPORTED = 'attribute_default_unsupported';
|
|
|
|
|
public const ATTRIBUTE_ALREADY_EXISTS = 'attribute_already_exists';
|
|
|
|
|
public const ATTRIBUTE_LIMIT_EXCEEDED = 'attribute_limit_exceeded';
|
|
|
|
|
public const ATTRIBUTE_VALUE_INVALID = 'attribute_value_invalid';
|
|
|
|
|
public const ATTRIBUTE_TYPE_INVALID = 'attribute_type_invalid';
|
2024-08-30 09:22:17 +00:00
|
|
|
public const ATTRIBUTE_INVALID_RESIZE = 'attribute_invalid_resize';
|
2022-02-06 16:50:48 +00:00
|
|
|
|
2024-04-09 12:32:23 +00:00
|
|
|
/** Relationship */
|
2024-04-09 12:38:55 +00:00
|
|
|
public const RELATIONSHIP_VALUE_INVALID = 'relationship_value_invalid';
|
2024-04-09 12:32:23 +00:00
|
|
|
|
2022-02-06 16:50:48 +00:00
|
|
|
/** Indexes */
|
2023-08-23 20:23:52 +00:00
|
|
|
public const INDEX_NOT_FOUND = 'index_not_found';
|
|
|
|
|
public const INDEX_LIMIT_EXCEEDED = 'index_limit_exceeded';
|
|
|
|
|
public const INDEX_ALREADY_EXISTS = 'index_already_exists';
|
|
|
|
|
public const INDEX_INVALID = 'index_invalid';
|
2025-01-15 09:16:10 +00:00
|
|
|
public const INDEX_DEPENDENCY = 'index_dependency';
|
2022-02-06 16:50:48 +00:00
|
|
|
|
2022-02-06 12:49:01 +00:00
|
|
|
/** Projects */
|
2023-08-23 20:23:52 +00:00
|
|
|
public const PROJECT_NOT_FOUND = 'project_not_found';
|
|
|
|
|
public const PROJECT_PROVIDER_DISABLED = 'project_provider_disabled';
|
|
|
|
|
public const PROJECT_PROVIDER_UNSUPPORTED = 'project_provider_unsupported';
|
|
|
|
|
public const PROJECT_ALREADY_EXISTS = 'project_already_exists';
|
|
|
|
|
public const PROJECT_INVALID_SUCCESS_URL = 'project_invalid_success_url';
|
|
|
|
|
public const PROJECT_INVALID_FAILURE_URL = 'project_invalid_failure_url';
|
|
|
|
|
public const PROJECT_RESERVED_PROJECT = 'project_reserved_project';
|
|
|
|
|
public const PROJECT_KEY_EXPIRED = 'project_key_expired';
|
|
|
|
|
|
|
|
|
|
public const PROJECT_SMTP_CONFIG_INVALID = 'project_smtp_config_invalid';
|
2023-05-23 05:09:17 +00:00
|
|
|
|
2023-05-11 06:52:27 +00:00
|
|
|
public const PROJECT_TEMPLATE_DEFAULT_DELETION = 'project_template_default_deletion';
|
2023-04-19 08:44:22 +00:00
|
|
|
|
2024-02-20 10:15:46 +00:00
|
|
|
public const PROJECT_REGION_UNSUPPORTED = 'project_region_unsupported';
|
|
|
|
|
|
2022-02-06 17:11:02 +00:00
|
|
|
/** Webhooks */
|
2023-08-23 20:23:52 +00:00
|
|
|
public const WEBHOOK_NOT_FOUND = 'webhook_not_found';
|
2022-02-06 17:11:02 +00:00
|
|
|
|
2023-02-09 14:27:11 +00:00
|
|
|
/** Router */
|
2023-07-29 16:03:13 +00:00
|
|
|
public const ROUTER_HOST_NOT_FOUND = 'router_host_not_found';
|
2023-08-20 12:14:05 +00:00
|
|
|
public const ROUTER_DOMAIN_NOT_CONFIGURED = 'router_domain_not_configured';
|
2023-02-09 14:27:11 +00:00
|
|
|
|
2023-03-08 18:30:01 +00:00
|
|
|
/** Proxy */
|
2024-02-15 09:36:34 +00:00
|
|
|
public const RULE_RESOURCE_NOT_FOUND = 'rule_resource_not_found';
|
|
|
|
|
public const RULE_NOT_FOUND = 'rule_not_found';
|
|
|
|
|
public const RULE_ALREADY_EXISTS = 'rule_already_exists';
|
|
|
|
|
public const RULE_VERIFICATION_FAILED = 'rule_verification_failed';
|
2023-03-08 18:30:01 +00:00
|
|
|
|
2022-02-06 17:11:02 +00:00
|
|
|
/** Keys */
|
2023-08-23 20:23:52 +00:00
|
|
|
public const KEY_NOT_FOUND = 'key_not_found';
|
2022-02-06 17:11:02 +00:00
|
|
|
|
2022-07-20 07:18:49 +00:00
|
|
|
/** Variables */
|
2023-08-23 20:23:52 +00:00
|
|
|
public const VARIABLE_NOT_FOUND = 'variable_not_found';
|
|
|
|
|
public const VARIABLE_ALREADY_EXISTS = 'variable_already_exists';
|
2025-02-07 15:06:57 +00:00
|
|
|
public const VARIABLE_CANNOT_UNSET_SECRET = 'variable_cannot_unset_secret';
|
2022-07-20 07:18:49 +00:00
|
|
|
|
2022-02-06 17:11:02 +00:00
|
|
|
/** Platform */
|
2023-08-23 20:23:52 +00:00
|
|
|
public const PLATFORM_NOT_FOUND = 'platform_not_found';
|
2022-02-06 17:11:02 +00:00
|
|
|
|
2022-04-26 07:49:36 +00:00
|
|
|
/** GraphqQL */
|
2023-08-23 20:23:52 +00:00
|
|
|
public const GRAPHQL_NO_QUERY = 'graphql_no_query';
|
|
|
|
|
public const GRAPHQL_TOO_MANY_QUERIES = 'graphql_too_many_queries';
|
2022-02-01 08:39:07 +00:00
|
|
|
|
2023-08-04 16:21:41 +00:00
|
|
|
/** Migrations */
|
2024-02-15 09:36:34 +00:00
|
|
|
public const MIGRATION_NOT_FOUND = 'migration_not_found';
|
|
|
|
|
public const MIGRATION_ALREADY_EXISTS = 'migration_already_exists';
|
|
|
|
|
public const MIGRATION_IN_PROGRESS = 'migration_in_progress';
|
|
|
|
|
public const MIGRATION_PROVIDER_ERROR = 'migration_provider_error';
|
2023-08-04 16:21:41 +00:00
|
|
|
|
2023-10-24 12:32:22 +00:00
|
|
|
/** Realtime */
|
2024-02-15 09:36:34 +00:00
|
|
|
public const REALTIME_MESSAGE_FORMAT_INVALID = 'realtime_message_format_invalid';
|
|
|
|
|
public const REALTIME_TOO_MANY_MESSAGES = 'realtime_too_many_messages';
|
|
|
|
|
public const REALTIME_POLICY_VIOLATION = 'realtime_policy_violation';
|
2023-11-16 18:21:09 +00:00
|
|
|
|
|
|
|
|
/** Health */
|
2024-02-15 09:36:34 +00:00
|
|
|
public const HEALTH_QUEUE_SIZE_EXCEEDED = 'health_queue_size_exceeded';
|
|
|
|
|
public const HEALTH_CERTIFICATE_EXPIRED = 'health_certificate_expired';
|
|
|
|
|
public const HEALTH_INVALID_HOST = 'health_invalid_host';
|
2023-08-04 16:21:41 +00:00
|
|
|
|
2023-08-17 11:54:45 +00:00
|
|
|
/** Provider */
|
2024-02-15 09:36:34 +00:00
|
|
|
public const PROVIDER_NOT_FOUND = 'provider_not_found';
|
|
|
|
|
public const PROVIDER_ALREADY_EXISTS = 'provider_already_exists';
|
|
|
|
|
public const PROVIDER_INCORRECT_TYPE = 'provider_incorrect_type';
|
|
|
|
|
public const PROVIDER_MISSING_CREDENTIALS = 'provider_missing_credentials';
|
2023-08-17 11:54:45 +00:00
|
|
|
|
2023-08-24 20:15:17 +00:00
|
|
|
/** Topic */
|
2024-02-15 09:36:34 +00:00
|
|
|
public const TOPIC_NOT_FOUND = 'topic_not_found';
|
|
|
|
|
public const TOPIC_ALREADY_EXISTS = 'topic_already_exists';
|
2023-08-28 15:11:05 +00:00
|
|
|
|
|
|
|
|
/** Subscriber */
|
2024-02-15 09:36:34 +00:00
|
|
|
public const SUBSCRIBER_NOT_FOUND = 'subscriber_not_found';
|
|
|
|
|
public const SUBSCRIBER_ALREADY_EXISTS = 'subscriber_already_exists';
|
2023-08-24 20:15:17 +00:00
|
|
|
|
2023-09-21 10:56:53 +00:00
|
|
|
/** Message */
|
2024-02-15 09:36:34 +00:00
|
|
|
public const MESSAGE_NOT_FOUND = 'message_not_found';
|
|
|
|
|
public const MESSAGE_MISSING_TARGET = 'message_missing_target';
|
|
|
|
|
public const MESSAGE_ALREADY_SENT = 'message_already_sent';
|
|
|
|
|
public const MESSAGE_ALREADY_PROCESSING = 'message_already_processing';
|
|
|
|
|
public const MESSAGE_ALREADY_FAILED = 'message_already_failed';
|
|
|
|
|
public const MESSAGE_ALREADY_SCHEDULED = 'message_already_scheduled';
|
|
|
|
|
public const MESSAGE_TARGET_NOT_EMAIL = 'message_target_not_email';
|
|
|
|
|
public const MESSAGE_TARGET_NOT_SMS = 'message_target_not_sms';
|
|
|
|
|
public const MESSAGE_TARGET_NOT_PUSH = 'message_target_not_push';
|
|
|
|
|
public const MESSAGE_MISSING_SCHEDULE = 'message_missing_schedule';
|
2023-11-30 22:09:43 +00:00
|
|
|
|
2024-02-15 04:23:30 +00:00
|
|
|
/** Targets */
|
|
|
|
|
public const TARGET_PROVIDER_INVALID_TYPE = 'target_provider_invalid_type';
|
|
|
|
|
|
2024-01-11 03:06:59 +00:00
|
|
|
/** Schedules */
|
2024-02-15 09:36:34 +00:00
|
|
|
public const SCHEDULE_NOT_FOUND = 'schedule_not_found';
|
2024-01-11 03:06:59 +00:00
|
|
|
|
2023-09-21 10:56:53 +00:00
|
|
|
|
2023-10-24 12:32:22 +00:00
|
|
|
protected string $type = '';
|
|
|
|
|
protected array $errors = [];
|
2024-02-12 01:18:19 +00:00
|
|
|
protected bool $publish;
|
2022-02-01 08:39:07 +00:00
|
|
|
|
2024-04-30 00:30:35 +00:00
|
|
|
public function __construct(string $type = Exception::GENERAL_UNKNOWN, string $message = null, int|string $code = null, \Throwable $previous = null)
|
2022-01-29 22:15:01 +00:00
|
|
|
{
|
2022-08-14 07:19:19 +00:00
|
|
|
$this->errors = Config::getParam('errors');
|
2022-02-06 21:46:47 +00:00
|
|
|
$this->type = $type;
|
2024-02-12 01:18:19 +00:00
|
|
|
$this->code = $code ?? $this->errors[$type]['code'];
|
2024-03-28 12:36:44 +00:00
|
|
|
|
2024-05-24 11:04:30 +00:00
|
|
|
// Mark string errors like HY001 from PDO as 500 errors
|
2024-09-04 09:06:59 +00:00
|
|
|
if (\is_string($this->code)) {
|
2024-04-30 00:28:29 +00:00
|
|
|
if (\is_numeric($this->code)) {
|
|
|
|
|
$this->code = (int) $this->code;
|
|
|
|
|
} else {
|
|
|
|
|
$this->code = 500;
|
|
|
|
|
}
|
2024-03-28 12:36:44 +00:00
|
|
|
}
|
|
|
|
|
|
2024-02-12 01:18:19 +00:00
|
|
|
$this->message = $message ?? $this->errors[$type]['description'];
|
2022-01-29 22:15:01 +00:00
|
|
|
|
2024-02-12 01:18:19 +00:00
|
|
|
$this->publish = $this->errors[$type]['publish'] ?? ($this->code >= 500);
|
2022-07-25 22:54:08 +00:00
|
|
|
|
|
|
|
|
parent::__construct($this->message, $this->code, $previous);
|
2022-01-29 22:15:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2022-02-08 23:08:23 +00:00
|
|
|
* Get the type of the exception.
|
2022-05-23 14:54:50 +00:00
|
|
|
*
|
2022-01-29 22:15:01 +00:00
|
|
|
* @return string
|
2022-05-23 14:54:50 +00:00
|
|
|
*/
|
2022-02-06 21:46:47 +00:00
|
|
|
public function getType(): string
|
2022-01-29 22:15:01 +00:00
|
|
|
{
|
2022-02-06 21:46:47 +00:00
|
|
|
return $this->type;
|
2022-01-29 22:15:01 +00:00
|
|
|
}
|
2022-02-08 23:08:23 +00:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Set the type of the exception.
|
2022-05-23 14:54:50 +00:00
|
|
|
*
|
2023-08-23 20:23:52 +00:00
|
|
|
* @param string $type
|
|
|
|
|
*
|
2022-02-08 23:08:23 +00:00
|
|
|
* @return void
|
|
|
|
|
*/
|
|
|
|
|
public function setType(string $type): void
|
|
|
|
|
{
|
|
|
|
|
$this->type = $type;
|
|
|
|
|
}
|
2023-11-16 18:21:09 +00:00
|
|
|
|
|
|
|
|
/**
|
2023-11-17 18:34:57 +00:00
|
|
|
* Check whether the log is publishable for the exception.
|
2023-11-16 18:21:09 +00:00
|
|
|
*
|
|
|
|
|
* @return bool
|
|
|
|
|
*/
|
2023-11-17 18:34:57 +00:00
|
|
|
public function isPublishable(): bool
|
2023-11-16 18:21:09 +00:00
|
|
|
{
|
2023-11-17 18:34:57 +00:00
|
|
|
return $this->publish;
|
2023-11-16 18:21:09 +00:00
|
|
|
}
|
2022-05-23 14:54:50 +00:00
|
|
|
}
|