File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -191,7 +191,21 @@ export class AccountPermissionSyncer {
191191 // @note : we only care about the private repos since we don't need to build a mapping
192192 // for public repos.
193193 // @see : packages/web/src/prisma.ts
194- const githubRepos = await getReposForAuthenticatedUser ( /* visibility = */ 'private' , octokit ) ;
194+ let githubRepos ;
195+ try {
196+ githubRepos = await getReposForAuthenticatedUser ( /* visibility = */ 'private' , octokit ) ;
197+ } catch ( error ) {
198+ if ( error && typeof error === 'object' && 'status' in error ) {
199+ const status = ( error as { status : number } ) . status ;
200+ if ( status === 401 || status === 403 ) {
201+ throw new Error (
202+ `GitHub API returned ${ status } error. Your token may have expired or lacks the required permissions. ` +
203+ `Please re-authorize with GitHub to grant the necessary access.`
204+ ) ;
205+ }
206+ }
207+ throw error ;
208+ }
195209 const gitHubRepoIds = githubRepos . map ( repo => repo . id . toString ( ) ) ;
196210
197211 const repos = await this . db . repo . findMany ( {
You can’t perform that action at this time.
0 commit comments