2022-01-30 11:15:01 +13:00
< ? php
2022-01-30 11:20:34 +13:00
/**
* List of server wide error codes and their respective messages .
*/
2022-01-30 11:50:07 +13:00
use Appwrite\Extend\Exception ;
2022-01-30 11:15:01 +13:00
return [
Exception :: TYPE_PROJECT_NOT_FOUND => [
'name' => Exception :: TYPE_PROJECT_NOT_FOUND ,
2022-01-30 12:08:56 +13:00
'description' => 'The requested project could not be found. Please check the value of the X-Appwrite-Project header to ensure the correct project ID is being used.' ,
2022-01-30 11:15:01 +13:00
'statusCode' => 404 ,
],
Exception :: TYPE_PROJECT_UNKNOWN => [
'name' => Exception :: TYPE_PROJECT_UNKNOWN ,
2022-01-30 12:08:56 +13:00
'description' => 'The project ID is either missing or not valid. Please check the value of the X-Appwrite-Project header to ensure the correct project ID is being used.' ,
'statusCode' => 400 ,
2022-01-30 11:15:01 +13:00
],
Exception :: TYPE_INVALID_ORIGIN => [
'name' => Exception :: TYPE_INVALID_ORIGIN ,
2022-01-30 12:12:34 +13:00
'description' => 'The request originated from a non-whitelisted origin. If you trust this origin, please add it as a platform in the Appwrite console.' ,
2022-01-30 11:15:01 +13:00
'statusCode' => 403 ,
],
Exception :: TYPE_SERVICE_DISABLED => [
'name' => Exception :: TYPE_SERVICE_DISABLED ,
2022-01-31 11:44:47 +13:00
'description' => 'The requested service is disabled. You can enable/disable a service from the Appwrite console or by contacting the project owner.' ,
2022-01-30 12:12:34 +13:00
'statusCode' => 503 ,
2022-01-30 11:15:01 +13:00
],
Exception :: TYPE_UNAUTHORIZED_SCOPE => [
'name' => Exception :: TYPE_UNAUTHORIZED_SCOPE ,
2022-01-30 12:13:55 +13:00
'description' => 'The current user is not authorized to access the requested resource.' ,
'statusCode' => 401 ,
2022-01-30 11:15:01 +13:00
],
Exception :: TYPE_PASSWORD_RESET_REQUIRED => [
'name' => Exception :: TYPE_PASSWORD_RESET_REQUIRED ,
2022-01-31 11:44:47 +13:00
'description' => 'The current user requires a password reset.' ,
'statusCode' => 412 ,
2022-01-30 11:15:01 +13:00
],
Exception :: TYPE_STORAGE_ERROR => [
'name' => Exception :: TYPE_STORAGE_ERROR ,
'description' => 'Storage error' ,
'statusCode' => 500 ,
],
Exception :: TYPE_RATE_LIMIT_EXCEEDED => [
'name' => Exception :: TYPE_RATE_LIMIT_EXCEEDED ,
2022-01-31 11:44:47 +13:00
'description' => 'Rate limit for the current endpoint has been exceeded. ' ,
2022-01-30 11:15:01 +13:00
'statusCode' => 429 ,
],
Exception :: TYPE_SMTP_DISABLED => [
'name' => Exception :: TYPE_SMTP_DISABLED ,
2022-01-31 11:44:47 +13:00
'description' => 'SMTP is disabled on your Appwrite instance. Please contact your project ' ,
'statusCode' => 503 ,
2022-01-30 11:15:01 +13:00
],
Exception :: TYPE_EMAIL_NOT_WHITELISTED => [
'name' => Exception :: TYPE_EMAIL_NOT_WHITELISTED ,
2022-01-31 11:44:47 +13:00
'description' => 'The user\'s email is not part of the whitelist. Please check the _APP_CONSOLE_WHITELIST_EMAILS environment variable of your Appwrite server.' ,
'statusCode' => 401 ,
2022-01-30 11:15:01 +13:00
],
Exception :: TYPE_IP_NOT_WHITELISTED => [
'name' => Exception :: TYPE_IP_NOT_WHITELISTED ,
2022-01-31 11:44:47 +13:00
'description' => 'The user\'s IP address is not part of the whitelist. Please check the _APP_CONSOLE_WHITELIST_IPS environment variable of your Appwrite server.' ,
'statusCode' => 401 ,
2022-01-30 11:15:01 +13:00
],
Exception :: TYPE_INVALID_CREDENTIALS => [
'name' => Exception :: TYPE_INVALID_CREDENTIALS ,
2022-01-31 11:44:47 +13:00
'description' => 'Invalid credentials. Please check the email and password.' ,
'statusCode' => 401 ,
2022-01-30 11:15:01 +13:00
],
Exception :: TYPE_INVALID_TOKEN => [
'name' => Exception :: TYPE_INVALID_TOKEN ,
2022-01-31 11:44:47 +13:00
'description' => 'The used token is invalid.' ,
'statusCode' => 401 ,
2022-01-30 11:15:01 +13:00
],
Exception :: TYPE_JWT_VERIFICATION_FAILED => [
'name' => Exception :: TYPE_JWT_VERIFICATION_FAILED ,
'description' => 'Invalid refresh token' ,
'statusCode' => 403 ,
],
Exception :: TYPE_ANONYMOUS_CONSOLE_USER => [
'name' => Exception :: TYPE_ANONYMOUS_CONSOLE_USER ,
'description' => 'Anonymous session cannot be created for the console project.' ,
2022-01-31 11:44:47 +13:00
'statusCode' => 401 ,
2022-01-30 11:15:01 +13:00
],
Exception :: TYPE_SESSION_NOT_FOUND => [
'name' => Exception :: TYPE_SESSION_NOT_FOUND ,
2022-01-31 11:44:47 +13:00
'description' => 'No valid session found.' ,
'statusCode' => 404 ,
2022-01-30 11:15:01 +13:00
],
Exception :: TYPE_SESSION_ALREADY_EXISTS => [
'name' => Exception :: TYPE_SESSION_ALREADY_EXISTS ,
2022-01-31 11:44:47 +13:00
'description' => 'Cannot create anonymous session when there is an active session.' ,
'statusCode' => 401 ,
2022-01-30 11:15:01 +13:00
],
Exception :: TYPE_USER_LIMIT_EXCEEDED => [
'name' => Exception :: TYPE_USER_LIMIT_EXCEEDED ,
2022-01-31 11:44:47 +13:00
'description' => 'The current project has exceeded the maximum number of users. Please check your user limit in the Appwrite console.' ,
'statusCode' => 501 ,
2022-01-30 11:15:01 +13:00
],
Exception :: TYPE_USER_ALREADY_EXISTS => [
'name' => Exception :: TYPE_USER_ALREADY_EXISTS ,
2022-01-31 11:44:47 +13:00
'description' => 'A user with the same email ID already exists in your project.' ,
'statusCode' => 409 ,
2022-01-30 11:15:01 +13:00
],
Exception :: TYPE_USER_BLOCKED => [
'name' => Exception :: TYPE_USER_BLOCKED ,
2022-01-31 11:44:47 +13:00
'description' => 'The current user has been blocked. Please contact the project administrator for more information.' ,
2022-01-30 12:27:29 +13:00
'statusCode' => 401 ,
2022-01-30 11:15:01 +13:00
],
Exception :: TYPE_USER_CREATION_FAILED => [
'name' => Exception :: TYPE_USER_CREATION_FAILED ,
2022-01-31 11:44:47 +13:00
'description' => 'There was an internal server error while creating the user.' ,
'statusCode' => 500 ,
2022-01-30 11:15:01 +13:00
],
Exception :: TYPE_USER_NOT_FOUND => [
'name' => Exception :: TYPE_USER_NOT_FOUND ,
2022-01-31 11:44:47 +13:00
'description' => 'User with the requested ID could not be found.' ,
'statusCode' => 404 ,
2022-01-30 11:15:01 +13:00
],
Exception :: TYPE_EMAIL_ALREADY_EXISTS => [
'name' => Exception :: TYPE_EMAIL_ALREADY_EXISTS ,
2022-01-31 11:44:47 +13:00
'description' => 'Another user with the same email already exists in the current project.' ,
'statusCode' => 409 ,
2022-01-30 11:15:01 +13:00
],
Exception :: TYPE_PASSWORD_MISMATCH => [
'name' => Exception :: TYPE_PASSWORD_MISMATCH ,
2022-01-31 11:44:47 +13:00
'description' => 'Passwords do not match. Please recheck.' ,
'statusCode' => 400 ,
2022-01-30 11:15:01 +13:00
],
Exception :: TYPE_AUTH_METHOD_UNSUPPORTED => [
'name' => Exception :: TYPE_AUTH_METHOD_UNSUPPORTED ,
2022-01-31 11:44:47 +13:00
'description' => 'The requested authentication method is either disabled or unsupported.' ,
'statusCode' => 501 ,
2022-01-30 11:15:01 +13:00
],
Exception :: TYPE_PROVIDER_DISABLED => [
'name' => Exception :: TYPE_PROVIDER_DISABLED ,
2022-01-31 11:44:47 +13:00
'description' => 'The chosen OAuth provider is disabled. Please contact your project administrator for more information.' ,
'statusCode' => 412 ,
2022-01-30 11:15:01 +13:00
],
2022-01-31 11:44:47 +13:00
Exception :: TYPE_PROVIDER_UNSUPPORTED => [
'name' => Exception :: TYPE_PROVIDER_UNSUPPORTED ,
'description' => 'The chosen OAuth provider is unsupported.' ,
'statusCode' => 501 ,
2022-01-30 11:15:01 +13:00
],
Exception :: TYPE_INVALID_LOGIN_STATE_PARAMS => [
'name' => Exception :: TYPE_INVALID_LOGIN_STATE_PARAMS ,
2022-01-31 11:44:47 +13:00
'description' => 'Failed to parse the login state params from the OAuth provider.' ,
'statusCode' => 500 ,
2022-01-30 11:15:01 +13:00
],
Exception :: TYPE_INVALID_SUCCESS_URL => [
'name' => Exception :: TYPE_INVALID_SUCCESS_URL ,
2022-01-31 11:44:47 +13:00
'description' => 'Invalid URL received for OAuth success redirect.' ,
'statusCode' => 400 ,
2022-01-30 11:15:01 +13:00
],
Exception :: TYPE_INVALID_FAILURE_URL => [
'name' => Exception :: TYPE_INVALID_FAILURE_URL ,
2022-01-31 11:44:47 +13:00
'description' => 'Invalid URL received for OAuth failure redirect.' ,
'statusCode' => 400 ,
2022-01-30 11:15:01 +13:00
],
Exception :: TYPE_OAUTH_ACCESS_TOKEN_FAILED => [
'name' => Exception :: TYPE_OAUTH_ACCESS_TOKEN_FAILED ,
2022-01-31 11:44:47 +13:00
'description' => 'Failed to obtain access token from the OAuth provider.' ,
'statusCode' => 500 ,
2022-01-30 11:15:01 +13:00
],
2022-01-31 11:44:47 +13:00
Exception :: TYPE_MISSING_USER_ID => [
'name' => Exception :: TYPE_MISSING_USER_ID ,
'description' => 'Failed to obtain user id from the OAuth provider.' ,
'statusCode' => 400 ,
2022-01-30 11:15:01 +13:00
]
];