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 +});