fix: improve error handling for GitLab API rate limit exceeded

This commit is contained in:
simple
2025-04-07 03:10:33 +09:00
parent a7a8149008
commit 11685d7a90

View File

@ -378,10 +378,20 @@ async function handleGitLabError(
): Promise<void> {
if (!response.ok) {
const errorBody = await response.text();
// Check specifically for Rate Limit error
if (response.status === 403 && errorBody.includes("User API Key Rate limit exceeded")) {
console.error("GitLab API Rate Limit Exceeded:", errorBody);
console.log("User API Key Rate limit exceeded. Please try again later.");
throw new Error(
`GitLab API Rate Limit Exceeded: ${errorBody}`
);
} else {
// Handle other API errors
throw new Error(
`GitLab API error: ${response.status} ${response.statusText}\n${errorBody}`
);
}
}
}
/**