Skip to content

Commit 281dae2

Browse files
authored
Throw if no top repos are found (#163)
1 parent 06a65d2 commit 281dae2

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/listTopRepos.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,13 @@ const skipRepos = [
3636

3737
async function mainAsync() {
3838
const repos = await getPopularRepos(language, repoCount, repoStartIndex, skipRepos);
39+
if (repos.length === 0) {
40+
throw new Error("No repos found");
41+
}
3942
await fs.promises.writeFile(outputPath, JSON.stringify(repos), { encoding: "utf-8" });
4043
}
4144

4245
mainAsync().catch(err => {
4346
reportError(err, "Unhandled exception");
4447
process.exit(1);
45-
});
48+
});

0 commit comments

Comments
 (0)