Skip to content

Commit e7f9e86

Browse files
authored
feat: add friendly tips for auth code validation (#201)
1 parent 884ea0c commit e7f9e86

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

src/app/[owner]/[repo]/page.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1420,7 +1420,9 @@ IMPORTANT:
14201420
}
14211421

14221422
if(authRequired && !authCode) {
1423-
console.warn("Authorization code is required");
1423+
setIsLoading(false);
1424+
console.error("Authorization code is required");
1425+
setError('Authorization code is required');
14241426
return;
14251427
}
14261428

@@ -1442,7 +1444,10 @@ IMPORTANT:
14421444
// setError(\`Cache clear failed: ${errorText}. Trying to refresh...\`);
14431445
if(response.status == 401) {
14441446
setIsLoading(false);
1445-
throw new Error('Failed to validate the authorization code');
1447+
setLoadingMessage(undefined);
1448+
setError('Failed to validate the authorization code');
1449+
console.error('Failed to validate the authorization code')
1450+
return;
14461451
}
14471452
}
14481453
} catch (err) {

src/app/page.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,10 @@ export default function Home() {
239239
// Check authorization code
240240
const validation = await validateAuthCode();
241241
if(!validation) {
242-
throw new Error('Failed to validate the authorization code');
242+
setError(`Failed to validate the authorization code`);
243+
console.error(`Failed to validate the authorization code`);
244+
setIsConfigModalOpen(false);
245+
return;
243246
}
244247

245248
// Prevent multiple submissions

0 commit comments

Comments
 (0)