1
0
Fork 0
mirror of synced 2024-10-02 10:16:27 +13:00

Updated the error to 501 error code for custom

domain when _APP_DOMAIN and _APP_DOMAIN_TARGET is setup incorrectly
This commit is contained in:
Bhaskar Singh 2023-03-05 14:35:47 +05:30
parent e8c74d7204
commit eaf31fdb78
3 changed files with 7 additions and 1 deletions

View file

@ -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.',

View file

@ -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);

View file

@ -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';