diff --git a/app/config/errors.php b/app/config/errors.php index 266e017e93..741fb406b8 100644 --- a/app/config/errors.php +++ b/app/config/errors.php @@ -474,6 +474,11 @@ return [ 'description' => 'Project with the requested ID 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::ENV_VARIABLE_INCORRECT_SETUP => [ + 'name' => Exception::ENV_VARIABLE_INCORRECT_SETUP, + 'description' => 'For Custom Domain ENV Variable is not setup correctly', + 'code' => 501, + ], 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.', diff --git a/app/controllers/api/projects.php b/app/controllers/api/projects.php index 29a193748d..6dc543d2c0 100644 --- a/app/controllers/api/projects.php +++ b/app/controllers/api/projects.php @@ -1340,7 +1340,7 @@ App::post('/v1/projects/:projectId/domains') $target = new Domain(App::getEnv('_APP_DOMAIN_TARGET', '')); if (!$target->isKnown() || $target->isTest()) { - throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Unreachable CNAME target (' . $target->get() . '), please use a domain with a public suffix.'); + throw new Exception(Exception::ENV_VARIABLE_INCORRECT_SETUP, 'Unreachable CNAME target (' . $target->get() . '), please use a domain with a public suffix.'); } $domain = new Domain($domain); diff --git a/src/Appwrite/Extend/Exception.php b/src/Appwrite/Extend/Exception.php index 8b240aa971..35ebc04b0c 100644 --- a/src/Appwrite/Extend/Exception.php +++ b/src/Appwrite/Extend/Exception.php @@ -177,6 +177,7 @@ class Exception extends \Exception public const DOMAIN_NOT_FOUND = 'domain_not_found'; public const DOMAIN_ALREADY_EXISTS = 'domain_already_exists'; public const DOMAIN_VERIFICATION_FAILED = 'domain_verification_failed'; + public const ENV_VARIABLE_INCORRECT_SETUP = 'env_variable_setup_incorrectly'; /** GraphqQL */ public const GRAPHQL_NO_QUERY = 'graphql_no_query';