Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions github-ratelimit.html
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,13 @@ <h1>GitHub Rate Limit Checker</h1>
});

if (!response.ok) {
throw new Error('Failed to fetch rate limit');
if (response.status === 401 || response.status === 403) {
localStorage.removeItem('GITHUB_TOKEN');
checkGithubAuth();
resultsDiv.innerHTML = '<div class="error">Authentication failed. Please authenticate again.</div>';
return;
}
throw new Error(`Failed to fetch rate limit: ${response.status} ${response.statusText}`);
}

const data = await response.json();
Expand Down Expand Up @@ -424,14 +430,7 @@ <h1>GitHub Rate Limit Checker</h1>

} catch (error) {
console.error('Rate limit check failed:', error);

if (error.message.includes('401') || error.message.includes('403')) {
localStorage.removeItem('GITHUB_TOKEN');
checkGithubAuth();
resultsDiv.innerHTML = '<div class="error">Authentication failed. Please authenticate again.</div>';
} else {
resultsDiv.innerHTML = `<div class="error">Failed to check rate limit: ${error.message}</div>`;
}
resultsDiv.innerHTML = `<div class="error">Failed to check rate limit: ${error.message}</div>`;
} finally {
checkRateLimitBtn.disabled = false;
checkRateLimitBtn.textContent = 'Check Rate Limit';
Expand Down