Skip to content

Commit

Permalink
handle api rate limit when search is not indexed
Browse files Browse the repository at this point in the history
  • Loading branch information
dphuang2 committed Dec 4, 2024
1 parent 3b267e8 commit f8b4373
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions generator/konfig-next-app/src/utils/github-search-files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,15 @@ export async function githubSearchFiles({

return result
} catch (error) {
if (
error instanceof Error &&
error.message.includes('API rate limit exceeded')
) {
console.warn(
'[GITHUB_SEARCH] GitHub API rate limit exceeded, returning null'
)
return null
}
if (error instanceof Error)
throw new Error(
`Error occurred while searching for files: ${error.message}`
Expand Down

0 comments on commit f8b4373

Please sign in to comment.