From e7cfa206e56ec274cea85dae6605f4979108be17 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Tue, 8 Feb 2022 03:04:06 +0400 Subject: [PATCH] feat: update descriptions of functions errors --- app/config/errors.php | 6 +++--- app/controllers/api/functions.php | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/config/errors.php b/app/config/errors.php index eb4143eab6..92055eb4d2 100644 --- a/app/config/errors.php +++ b/app/config/errors.php @@ -270,21 +270,21 @@ return [ /** Functions */ Exception::FUNCTION_NOT_FOUND => [ 'name' => Exception::FUNCTION_NOT_FOUND, - 'description' => 'The requested function could not be found.', + 'description' => 'Function with the requested ID could not be found.', 'code' => 404, ], /** Deployments */ Exception::DEPLOYMENT_NOT_FOUND => [ 'name' => Exception::DEPLOYMENT_NOT_FOUND, - 'description' => 'The requested deployment could not be found.', + 'description' => 'Deployment with the requested ID could not be found.', 'code' => 404, ], /** Executions */ Exception::EXECUTION_NOT_FOUND => [ 'name' => Exception::EXECUTION_NOT_FOUND, - 'description' => 'The requested execution could not be found.', + 'description' => 'Execution with the requested ID could not be found.', 'code' => 404, ], diff --git a/app/controllers/api/functions.php b/app/controllers/api/functions.php index d592ae2670..9e12558406 100644 --- a/app/controllers/api/functions.php +++ b/app/controllers/api/functions.php @@ -554,6 +554,7 @@ App::get('/v1/functions/:functionId/tags') $cursorTag = $dbForProject->getDocument('tags', $cursor); if ($cursorTag->isEmpty()) { + // TODO: Shouldn't this be a 404 error ? throw new Exception("Tag '{$cursor}' for the 'cursor' value not found.", 400, Exception::DEPLOYMENT_NOT_FOUND); } } @@ -807,6 +808,8 @@ App::get('/v1/functions/:functionId/executions') $cursorExecution = $dbForProject->getDocument('executions', $cursor); if ($cursorExecution->isEmpty()) { + // TODO: Shouldn't this be a 404 error ? + // Or do we define a new error type GENERAL_CURSOR_NOT_FOUND for these types ? throw new Exception("Execution '{$cursor}' for the 'cursor' value not found.", 400, Exception::EXECUTION_NOT_FOUND); } }