1
0
Fork 0
mirror of synced 2024-07-04 14:10:33 +12:00

Add try-catch to listRepositories

This commit is contained in:
Khushboo Verma 2023-08-01 14:10:16 +05:30
parent c8010ecae8
commit 5b9f71afe5
2 changed files with 28 additions and 23 deletions

@ -1 +1 @@
Subproject commit 9256f224d2252a0108cd354814f47ad90b1cdec9 Subproject commit 1d75b39555221479ff92d54ecf8b452bfd503f5e

View file

@ -15,6 +15,7 @@ use Appwrite\Extend\Exception;
use Appwrite\Network\Validator\Host; use Appwrite\Network\Validator\Host;
use Appwrite\Utopia\Database\Validator\Queries\Installations; use Appwrite\Utopia\Database\Validator\Queries\Installations;
use Appwrite\Vcs\Comment; use Appwrite\Vcs\Comment;
use Utopia\CLI\Console;
use Utopia\Config\Config; use Utopia\Config\Config;
use Utopia\Database\DateTime; use Utopia\Database\DateTime;
use Utopia\Database\Query; use Utopia\Database\Query;
@ -528,6 +529,7 @@ App::get('/v1/vcs/github/installations/:installationId/providerRepositories')
$repos = batch(\array_map(function ($repo) use ($github) { $repos = batch(\array_map(function ($repo) use ($github) {
return function () use ($repo, $github) { return function () use ($repo, $github) {
try {
$files = $github->listRepositoryContents($repo['organization'], $repo['name'], ''); $files = $github->listRepositoryContents($repo['organization'], $repo['name'], '');
$languages = $github->getRepositoryLanguages($repo['organization'], $repo['name']); $languages = $github->getRepositoryLanguages($repo['organization'], $repo['name']);
@ -553,13 +555,16 @@ App::get('/v1/vcs/github/installations/:installationId/providerRepositories')
}))[0] ?? ''; }))[0] ?? '';
$repo['runtime'] = $runtimeDetail; $repo['runtime'] = $runtimeDetail;
} catch (Throwable $error) {
$repo['runtime'] = "";
Console::warning("Runtime not detected for " . $repo['organization'] . "/" . $repo['name']);
}
return $repo; return $repo;
}; };
}, $repos)); }, $repos));
$response->dynamic(new Document([ $response->dynamic(new Document([
'repositories' => $repos, 'providerRepositories' => $repos,
'total' => \count($repos), 'total' => \count($repos),
]), Response::MODEL_PROVIDER_REPOSITORY_LIST); ]), Response::MODEL_PROVIDER_REPOSITORY_LIST);
}); });