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:
parent
e8c74d7204
commit
eaf31fdb78
3 changed files with 7 additions and 1 deletions
|
@ -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.',
|
'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,
|
'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 => [
|
Exception::PROJECT_UNKNOWN => [
|
||||||
'name' => 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.',
|
'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.',
|
||||||
|
|
|
@ -1340,7 +1340,7 @@ App::post('/v1/projects/:projectId/domains')
|
||||||
$target = new Domain(App::getEnv('_APP_DOMAIN_TARGET', ''));
|
$target = new Domain(App::getEnv('_APP_DOMAIN_TARGET', ''));
|
||||||
|
|
||||||
if (!$target->isKnown() || $target->isTest()) {
|
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);
|
$domain = new Domain($domain);
|
||||||
|
|
|
@ -177,6 +177,7 @@ class Exception extends \Exception
|
||||||
public const DOMAIN_NOT_FOUND = 'domain_not_found';
|
public const DOMAIN_NOT_FOUND = 'domain_not_found';
|
||||||
public const DOMAIN_ALREADY_EXISTS = 'domain_already_exists';
|
public const DOMAIN_ALREADY_EXISTS = 'domain_already_exists';
|
||||||
public const DOMAIN_VERIFICATION_FAILED = 'domain_verification_failed';
|
public const DOMAIN_VERIFICATION_FAILED = 'domain_verification_failed';
|
||||||
|
public const ENV_VARIABLE_INCORRECT_SETUP = 'env_variable_setup_incorrectly';
|
||||||
|
|
||||||
/** GraphqQL */
|
/** GraphqQL */
|
||||||
public const GRAPHQL_NO_QUERY = 'graphql_no_query';
|
public const GRAPHQL_NO_QUERY = 'graphql_no_query';
|
||||||
|
|
Loading…
Reference in a new issue