1
0
Fork 0
mirror of synced 2024-06-02 19:04:49 +12:00

feat: rearrange errors

This commit is contained in:
Christy Jacob 2022-02-08 01:10:36 +04:00
parent 5e41aad012
commit e0e5f24ddb
2 changed files with 60 additions and 60 deletions

View file

@ -49,53 +49,6 @@ return [
'code' => 500,
],
/** Project Errors */
Exception::PROJECT_NOT_FOUND => [
'name' => Exception::PROJECT_NOT_FOUND,
'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.',
'code' => 404,
],
Exception::PROJECT_UNKNOWN => [
'name' => Exception::PROJECT_UNKNOWN,
'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.',
'code' => 400,
],
Exception::WEBHOOK_NOT_FOUND => [
'name' => Exception::WEBHOOK_NOT_FOUND,
'description' => 'The requested webhook could not be found.',
'code' => 404,
],
Exception::KEY_NOT_FOUND => [
'name' => Exception::KEY_NOT_FOUND,
'description' => 'The requested key could not be found.',
'code' => 404,
],
Exception::PLATFORM_NOT_FOUND => [
'name' => Exception::PLATFORM_NOT_FOUND,
'description' => 'The requested platform could not be found.',
'code' => 404,
],
Exception::DOMAIN_NOT_FOUND => [
'name' => Exception::DOMAIN_NOT_FOUND,
'description' => 'The requested domain could not be found.',
'code' => 404,
],
Exception::DOMAIN_ALREADY_EXISTS => [
'name' => Exception::DOMAIN_ALREADY_EXISTS,
'description' => 'The requested domain already exists.',
'code' => 409,
],
Exception::DOMAIN_UNREACHABLE => [
'name' => Exception::DOMAIN_UNREACHABLE,
'description' => 'The requested domain is not reachable.',
'code' => 503,
],
Exception::DOMAIN_VERIFICATION_FAILED => [
'name' => Exception::DOMAIN_VERIFICATION_FAILED,
'description' => 'The requested domain verification failed.',
'code' => 503,
],
/** User Errors */
Exception::USER_COUNT_EXCEEDED => [
'name' => Exception::USER_COUNT_EXCEEDED,
@ -439,4 +392,51 @@ return [
'description' => 'The query is invalid.',
'code' => 400,
],
/** Project Errors */
Exception::PROJECT_NOT_FOUND => [
'name' => Exception::PROJECT_NOT_FOUND,
'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.',
'code' => 404,
],
Exception::PROJECT_UNKNOWN => [
'name' => Exception::PROJECT_UNKNOWN,
'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.',
'code' => 400,
],
Exception::WEBHOOK_NOT_FOUND => [
'name' => Exception::WEBHOOK_NOT_FOUND,
'description' => 'The requested webhook could not be found.',
'code' => 404,
],
Exception::KEY_NOT_FOUND => [
'name' => Exception::KEY_NOT_FOUND,
'description' => 'The requested key could not be found.',
'code' => 404,
],
Exception::PLATFORM_NOT_FOUND => [
'name' => Exception::PLATFORM_NOT_FOUND,
'description' => 'The requested platform could not be found.',
'code' => 404,
],
Exception::DOMAIN_NOT_FOUND => [
'name' => Exception::DOMAIN_NOT_FOUND,
'description' => 'The requested domain could not be found.',
'code' => 404,
],
Exception::DOMAIN_ALREADY_EXISTS => [
'name' => Exception::DOMAIN_ALREADY_EXISTS,
'description' => 'The requested domain already exists.',
'code' => 409,
],
Exception::DOMAIN_UNREACHABLE => [
'name' => Exception::DOMAIN_UNREACHABLE,
'description' => 'The requested domain is not reachable.',
'code' => 503,
],
Exception::DOMAIN_VERIFICATION_FAILED => [
'name' => Exception::DOMAIN_VERIFICATION_FAILED,
'description' => 'The requested domain verification failed.',
'code' => 503,
]
];

View file

@ -11,6 +11,7 @@ class Exception extends \Exception
* <ENTITY>_<ERROR_TYPE>
*
* Appwrite has the follwing entities:
* - General
* - Users
* - OAuth
* - Teams
@ -30,9 +31,19 @@ class Exception extends \Exception
* - Keys
* - Platform
* - Domain
* - General
*/
/** General */
const GENERAL_DEFAULT = 'general_default';
const GENERAL_ACCESS_FORBIDDEN = 'general_access_forbidden';
const GENERAL_UNKNOWN_ORIGIN = 'general_unknown_origin';
const GENERAL_SERVICE_DISABLED = 'general_service_disabled';
const GENERAL_UNAUTHORIZED_SCOPE = 'general_unauthorized_scope';
const GENERAL_RATE_LIMIT_EXCEEDED = 'general_rate_limit_exceeded';
const GENERAL_SMTP_DISABLED = 'general_smtp_disabled';
const GENERAL_ARGUMENT_INVALID = 'general_argument_invalid';
const GENERAL_SERVER_ERROR = 'general_server_error';
/** Users */
const USER_COUNT_EXCEEDED = 'user_count_exceeded';
const USER_JWT_INVALID = 'user_jwt_invalid';
@ -120,7 +131,7 @@ class Exception extends \Exception
const INDEX_LIMIT_EXCEEDED = 'index_limit_exceeded';
const INDEX_ALREADY_EXISTS = 'index_already_exists';
/** Query limit exceeded */
/** Query */
const QUERY_LIMIT_EXCEEDED = 'query_limit_exceeded';
const QUERY_INVALID = 'query_invalid';
@ -143,17 +154,6 @@ class Exception extends \Exception
const DOMAIN_UNREACHABLE = 'domain_unreachable';
const DOMAIN_VERIFICATION_FAILED = 'domain_verification_failed';
/** General */
const GENERAL_DEFAULT = 'general_default';
const GENERAL_ACCESS_FORBIDDEN = 'general_access_forbidden';
const GENERAL_UNKNOWN_ORIGIN = 'general_unknown_origin';
const GENERAL_SERVICE_DISABLED = 'general_service_disabled';
const GENERAL_UNAUTHORIZED_SCOPE = 'general_unauthorized_scope';
const GENERAL_RATE_LIMIT_EXCEEDED = 'general_rate_limit_exceeded';
const GENERAL_SMTP_DISABLED = 'general_smtp_disabled';
const GENERAL_ARGUMENT_INVALID = 'general_argument_invalid';
const GENERAL_SERVER_ERROR = 'general_server_error';
private $type = '';