If build has failed, show correct error page

This commit is contained in:
Khushboo Verma
2025-03-24 15:50:25 +05:30
parent 0f182817ec
commit bd18edc197
3 changed files with 11 additions and 1 deletions
+5
View File
@@ -580,6 +580,11 @@ return [
'description' => 'Build with the requested ID is already completed and cannot be canceled.',
'code' => 400,
],
Exception::BUILD_FAILED => [
'name' => Exception::BUILD_FAILED,
'description' => 'Build with the requested ID failed. Please check the logs for more information.',
'code' => 400,
],
/** Deployments */
Exception::DEPLOYMENT_NOT_FOUND => [
+5 -1
View File
@@ -269,10 +269,14 @@ function router(App $utopia, Database $dbForPlatform, callable $getProjectDB, Sw
throw new AppwriteException(AppwriteException::FUNCTION_RUNTIME_UNSUPPORTED, 'Runtime "' . $resource->getAttribute('runtime', '') . '" is not supported');
}
if ($deployment->getAttribute('status') !== 'ready') {
if ($deployment->getAttribute('status') === 'waiting' || $deployment->getAttribute('status') === 'processing' || $deployment->getAttribute('status') === 'building') {
throw new AppwriteException(AppwriteException::BUILD_NOT_READY);
}
if ($deployment->getAttribute('status') === 'failed') {
throw new AppwriteException(AppwriteException::BUILD_FAILED);
}
if ($type === 'function') {
$permissions = $resource->getAttribute('execute');
if (!(\in_array('any', $permissions)) && !(\in_array('guests', $permissions))) {
+1
View File
@@ -174,6 +174,7 @@ class Exception extends \Exception
public const BUILD_NOT_READY = 'build_not_ready';
public const BUILD_IN_PROGRESS = 'build_in_progress';
public const BUILD_ALREADY_COMPLETED = 'build_already_completed';
public const BUILD_FAILED = 'build_failed';
/** Execution */
public const EXECUTION_NOT_FOUND = 'execution_not_found';