New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: add the type property to the AppwriteException declaration #74
fix: add the type property to the AppwriteException declaration #74
Conversation
It could also be cool to have a proper type for the type property instead of using string and having a dictionnary of possible AppwriteException types like: export const AppwritePlatformErrors = {
general_mock: 'general_mock',
general_argument_invalid: 'general_argument_invalid',
general_query_limit_exceeded: 'general_query_limit_exceeded',
general_query_invalid: 'general_query_invalid',
general_cursor_not_found: 'general_cursor_not_found',
general_provider_failure: 'general_provider_failure',
project_unknown: 'project_unknown',
project_invalid_success_url: 'project_invalid_success_url',
project_invalid_failure_url: 'project_invalid_failure_url',
project_reserved_project: 'project_reserved_project',
project_smtp_config_invalid: 'project_smtp_config_invalid',
project_key_expired: 'project_key_expired',
rule_verification_failed: 'rule_verification_failed',
project_template_default_deletion: 'project_template_default_deletion',
general_unknown_origin: 'general_unknown_origin',
general_access_forbidden: 'general_access_forbidden',
general_unauthorized_scope: 'general_unauthorized_scope',
general_route_not_found: 'general_route_not_found',
webhook_not_found: 'webhook_not_found',
rule_resource_not_found: 'rule_resource_not_found',
rule_not_found: 'rule_not_found',
key_not_found: 'key_not_found',
platform_not_found: 'platform_not_found',
project_not_found: 'project_not_found',
router_host_not_found: 'router_host_not_found',
general_not_implemented: 'general_not_implemented',
project_already_exists: 'project_already_exists',
rule_already_exists: 'rule_already_exists',
project_provider_disabled: 'project_provider_disabled',
general_rate_limit_exceeded: 'general_rate_limit_exceeded',
general_unknown: 'general_unknown',
general_server_error: 'general_server_error',
general_protocol_unsupported: 'general_protocol_unsupported',
general_codes_disabled: 'general_codes_disabled',
router_domain_not_configured: 'router_domain_not_configured',
general_usage_disabled: 'general_usage_disabled',
project_provider_unsupported: 'project_provider_unsupported',
general_service_disabled: 'general_service_disabled',
general_smtp_disabled: 'general_smtp_disabled',
general_phone_disabled: 'general_phone_disabled',
} as const;
export const AppwriteAuthErrors = {
user_password_mismatch: 'user_password_mismatch',
password_recently_used: 'password_recently_used',
password_personal_data: 'password_personal_data',
user_phone_not_found: 'user_phone_not_found',
user_missing_id: 'user_missing_id',
user_oauth2_bad_request: 'user_oauth2_bad_request',
user_jwt_invalid: 'user_jwt_invalid',
user_blocked: 'user_blocked',
user_invalid_token: 'user_invalid_token',
user_email_not_whitelisted: 'user_email_not_whitelisted',
user_invalid_code: 'user_invalid_code',
user_ip_not_whitelisted: 'user_ip_not_whitelisted',
user_invalid_credentials: 'user_invalid_credentials',
user_anonymous_console_prohibited: 'user_anonymous_console_prohibited',
user_session_already_exists: 'user_session_already_exists',
user_unauthorized: 'user_unauthorized',
user_oauth2_unauthorized: 'user_oauth2_unauthorized',
team_invalid_secret: 'team_invalid_secret',
team_invite_mismatch: 'team_invite_mismatch',
user_not_found: 'user_not_found',
user_session_not_found: 'user_session_not_found',
user_identity_not_found: 'user_identity_not_found',
team_not_found: 'team_not_found',
team_invite_not_found: 'team_invite_not_found',
team_membership_mismatch: 'team_membership_mismatch',
membership_not_found: 'membership_not_found',
user_already_exists: 'user_already_exists',
user_email_already_exists: 'user_email_already_exists',
user_phone_already_exists: 'user_phone_already_exists',
team_invite_already_exists: 'team_invite_already_exists',
team_already_exists: 'team_already_exists',
membership_already_confirmed: 'membership_already_confirmed',
user_password_reset_required: 'user_password_reset_required',
user_oauth2_provider_error: 'user_oauth2_provider_error',
user_count_exceeded: 'user_count_exceeded',
user_auth_method_unsupported: 'user_auth_method_unsupported',
} as const;
export const AppwriteDatabaseErrors = {
collection_limit_exceeded: 'collection_limit_exceeded',
document_invalid_structure: 'document_invalid_structure',
document_missing_data: 'document_missing_data',
document_missing_payload: 'document_missing_payload',
attribute_unknown: 'attribute_unknown',
attribute_not_available: 'attribute_not_available',
attribute_format_unsupported: 'attribute_format_unsupported',
attribute_default_unsupported: 'attribute_default_unsupported',
attribute_limit_exceeded: 'attribute_limit_exceeded',
attribute_value_invalid: 'attribute_value_invalid',
attribute_type_invalid: 'attribute_type_invalid',
index_limit_exceeded: 'index_limit_exceeded',
index_invalid: 'index_invalid',
document_delete_restricted: 'document_delete_restricted',
execution_not_found: 'execution_not_found',
database_not_found: 'database_not_found',
collection_not_found: 'collection_not_found',
document_not_found: 'document_not_found',
attribute_not_found: 'attribute_not_found',
index_not_found: 'index_not_found',
database_already_exists: 'database_already_exists',
collection_already_exists: 'collection_already_exists',
document_already_exists: 'document_already_exists',
document_update_conflict: 'document_update_conflict',
attribute_already_exists: 'attribute_already_exists',
index_already_exists: 'index_already_exists',
} as const;
export const AppwriteStorageErrors = {
storage_device_not_found: 'storage_device_not_found',
storage_file_empty: 'storage_file_empty',
storage_file_type_unsupported: 'storage_file_type_unsupported',
storage_invalid_file_size: 'storage_invalid_file_size',
storage_invalid_content_range: 'storage_invalid_content_range',
storage_invalid_appwrite_id: 'storage_invalid_appwrite_id',
storage_invalid_file: 'storage_invalid_file',
storage_file_not_found: 'storage_file_not_found',
storage_bucket_not_found: 'storage_bucket_not_found',
storage_file_already_exists: 'storage_file_already_exists',
storage_bucket_already_exists: 'storage_bucket_already_exists',
storage_invalid_range: 'storage_invalid_range',
} as const;
const AppwriteFunctionsErrors = {
build_not_ready: 'build_not_ready',
build_in_progress: 'build_in_progress',
installation_not_found: 'installation_not_found',
provider_repository_not_found: 'provider_repository_not_found',
repository_not_found: 'repository_not_found',
function_not_found: 'function_not_found',
function_runtime_unsupported: 'function_runtime_unsupported',
build_not_found: 'build_not_found',
deployment_not_found: 'deployment_not_found',
variable_not_found: 'variable_not_found',
provider_contribution_conflict: 'provider_contribution_conflict',
variable_already_exists: 'variable_already_exists',
} as const;
const AppwriteMigrationErrors = {
migration_not_found: 'migration_not_found',
migration_already_exists: 'migration_already_exists',
migration_in_progress: 'migration_in_progress',
} as const;
const AppwriteAvatarErrors = {
avatar_set_not_found: 'avatar_set_not_found',
avatar_not_found: 'avatar_not_found',
avatar_image_not_found: 'avatar_image_not_found',
avatar_remote_url_failed: 'avatar_remote_url_failed',
avatar_icon_not_found: 'avatar_icon_not_found',
} as const;
export const AppwriteGraphQLErrors = {
graphql_no_query: 'graphql_no_query',
graphql_too_many_queries: 'graphql_too_many_queries',
} as const;
export type AppwriteExceptionTypes =
| (typeof AppwritePlatformErrors)[keyof typeof AppwritePlatformErrors]
| (typeof AppwriteAuthErrors)[keyof typeof AppwriteAuthErrors]
| (typeof AppwriteDatabaseErrors)[keyof typeof AppwriteDatabaseErrors]
| (typeof AppwriteStorageErrors)[keyof typeof AppwriteStorageErrors]
| (typeof AppwriteFunctionsErrors)[keyof typeof AppwriteFunctionsErrors]
| (typeof AppwriteMigrationErrors)[keyof typeof AppwriteMigrationErrors]
| (typeof AppwriteAvatarErrors)[keyof typeof AppwriteAvatarErrors]
| (typeof AppwriteGraphQLErrors)[keyof typeof AppwriteGraphQLErrors]; |
@Splinteer thanks for the PR! Appreciate the effort. This repository is readonly, and generated using the https://github.com/appwrite/sdk-generator repository. Unfortunately that means you'll have to cherry pick this change over there for it to be permanent. |
What does this PR do?
This PR add the missing type property to the AppwriteException declaration
Test Plan
No test plan, it's only declaration
Related PRs and Issues
#73
Have you read the Contributing Guidelines on issues?
Yes