Skip to content

Commit

Permalink
Merge pull request #8 from utopia-php/fix-vcs-errors
Browse files Browse the repository at this point in the history
Throw exception if repository not found
  • Loading branch information
christyjacob4 committed Oct 13, 2023
2 parents 47144f2 + 6bb4f19 commit be86617
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/VCS/Adapter/Git/GitHub.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use Exception;
use Utopia\Cache\Cache;
use Utopia\VCS\Adapter\Git;
use Utopia\VCS\Exception\RepositoryNotFound;

class GitHub extends Git
{
Expand Down Expand Up @@ -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'];
Expand Down
7 changes: 7 additions & 0 deletions src/VCS/Exception/RepositoryNotFound.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

namespace Utopia\VCS\Exception;

class RepositoryNotFound extends \Exception
{
}
2 changes: 1 addition & 1 deletion tests/Detector/DetectorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']
];

Expand Down

0 comments on commit be86617

Please sign in to comment.