From 8ca942dd94cd1e93a4d2960d07304991cf413fe1 Mon Sep 17 00:00:00 2001 From: Jake Bailey <5341706+jakebailey@users.noreply.github.com> Date: Thu, 27 Jun 2024 12:47:55 -0700 Subject: [PATCH] Throw if no top repos are found --- src/listTopRepos.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/listTopRepos.ts b/src/listTopRepos.ts index 38c3d29..dbd47bb 100644 --- a/src/listTopRepos.ts +++ b/src/listTopRepos.ts @@ -36,10 +36,13 @@ const skipRepos = [ async function mainAsync() { const repos = await getPopularRepos(language, repoCount, repoStartIndex, skipRepos); + if (repos.length === 0) { + throw new Error("No repos found"); + } await fs.promises.writeFile(outputPath, JSON.stringify(repos), { encoding: "utf-8" }); } mainAsync().catch(err => { reportError(err, "Unhandled exception"); process.exit(1); -}); \ No newline at end of file +});