From d2ee2f2b29b21c89e7a75dddbec8d3b63680cf65 Mon Sep 17 00:00:00 2001 From: Khushboo Verma <43381712+vermakhushboo@users.noreply.github.com> Date: Fri, 13 Oct 2023 14:20:06 +0530 Subject: [PATCH 1/4] Throw exception if repository not found --- src/VCS/Adapter/Git/GitHub.php | 3 ++- src/VCS/Exception.php | 7 +++++++ src/VCS/Exception/RepositoryNotFound.php | 9 +++++++++ 3 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 src/VCS/Exception.php create mode 100644 src/VCS/Exception/RepositoryNotFound.php diff --git a/src/VCS/Adapter/Git/GitHub.php b/src/VCS/Adapter/Git/GitHub.php index 721ee983..1f2da01a 100644 --- a/src/VCS/Adapter/Git/GitHub.php +++ b/src/VCS/Adapter/Git/GitHub.php @@ -6,6 +6,7 @@ use Exception; use Utopia\Cache\Cache; use Utopia\VCS\Adapter\Git; +use Utopia\VCS\Exception\RepositoryNotFound; class GitHub extends Git { @@ -143,7 +144,7 @@ public function getRepositoryName(string $repositoryId): string $response = $this->call(self::METHOD_GET, $url, ['Authorization' => "Bearer $this->accessToken"]); if (!isset($response['body']['name'])) { - throw new Exception("Repository name not found"); + throw new RepositoryNotFound("Repository not found"); } return $response['body']['name']; diff --git a/src/VCS/Exception.php b/src/VCS/Exception.php new file mode 100644 index 00000000..03979196 --- /dev/null +++ b/src/VCS/Exception.php @@ -0,0 +1,7 @@ + Date: Fri, 13 Oct 2023 14:39:18 +0530 Subject: [PATCH 2/4] Updated bun repo example --- tests/Detector/DetectorTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Detector/DetectorTest.php b/tests/Detector/DetectorTest.php index e54be498..3174d768 100644 --- a/tests/Detector/DetectorTest.php +++ b/tests/Detector/DetectorTest.php @@ -72,7 +72,7 @@ public function testLanguageDetection(): void ['Dobiasd', 'FunctionalPlus', 'cpp'], ['anthonychu', 'azure-functions-deno-worker', 'deno'], ['mono', 'mono-basic', 'dotnet'], - ['Meldiron', 'bun-function', 'bun'], + ['vermakhushboo', 'bun-function', 'bun'], ['cytoscape', 'cytoscape.js', 'node'] ]; From ac242903a3334cba22009415fb8506da7a86a2af Mon Sep 17 00:00:00 2001 From: Khushboo Verma <43381712+vermakhushboo@users.noreply.github.com> Date: Fri, 13 Oct 2023 18:23:30 +0530 Subject: [PATCH 3/4] Extended \Exception instead of Exception --- src/VCS/Exception/RepositoryNotFound.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/VCS/Exception/RepositoryNotFound.php b/src/VCS/Exception/RepositoryNotFound.php index 99cf0088..5f5cc145 100644 --- a/src/VCS/Exception/RepositoryNotFound.php +++ b/src/VCS/Exception/RepositoryNotFound.php @@ -2,8 +2,6 @@ namespace Utopia\VCS\Exception; -use Utopia\VCS\Exception; - -class RepositoryNotFound extends Exception +class RepositoryNotFound extends \Exception { } From 6bb4f1988a9afc755afbb9013c16bc0764be9dd7 Mon Sep 17 00:00:00 2001 From: Khushboo Verma <43381712+vermakhushboo@users.noreply.github.com> Date: Fri, 13 Oct 2023 18:36:02 +0530 Subject: [PATCH 4/4] Remove Exception.php --- src/VCS/Exception.php | 7 ------- 1 file changed, 7 deletions(-) delete mode 100644 src/VCS/Exception.php diff --git a/src/VCS/Exception.php b/src/VCS/Exception.php deleted file mode 100644 index 03979196..00000000 --- a/src/VCS/Exception.php +++ /dev/null @@ -1,7 +0,0 @@ -